Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/asic/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.2
0.4.3
6 changes: 4 additions & 2 deletions src/asic/files/definitions/adem.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ def preprocess(self, target: Path | BytesIO | StringIO) -> pd.DataFrame:
EPSC: Código SIC del agente comercializador
CODIGO:
DMRE: demanda regulada
DMNR: demanda no regulada
PRRE: perdidas reguladas
PRNR: perdidas no reguladas
"""
total = self.read(target)
total["FECHA"] = f"{self.year:04d}-{self.month:02d}-{self.day:02d}"

filter = np.full(total.index.shape, True)
filter = filter & (total["CODIGO"].isin(["DMRE", "PRRE"]))
filter = filter & (total["CODIGO"].isin(["DMRE", "PRRE","DMNR","PRNR"]))

total = total[filter]
total["FECHA"] = pd.to_datetime(
Expand Down Expand Up @@ -145,6 +147,6 @@ def preprocess(self, target: Path | BytesIO | StringIO) -> pd.DataFrame:
)
]
total.columns = cols # type: ignore
return_cols = ["FECHA_HORA", "AGENTE", "DMRE_VALOR", "PRRE_VALOR"]
return_cols = ["FECHA_HORA", "AGENTE", "DMRE_VALOR", "PRRE_VALOR","DMNR_VALOR","PRNR_VALOR"]
return total[return_cols]

2 changes: 1 addition & 1 deletion src/asic/files/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class FileKind(str, enum.Enum):
SNTIE = "sntie"
AFAC = "afac"
DSPCTTOS = "dspcttos"
PTB = "ptb"
PTB = "PTB"

# LDCBMR = "ldcbmr"
# PUBFC = "pubfc"
Expand Down
2 changes: 1 addition & 1 deletion tests/TEST_ASIC_FILE_CONFIG.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
{"code":"trsm", "visibility": "public","name_pattern":"(?P<kind>trsm)(?P<name_month>[0-9]{2}).(?P<ext_versioned>[a-zA-Z0-9]+)","location_pattern":"/RUTA/PUBLICA/DEL/FTP/(?P<location_year>[0-9]{4})-(?P<location_month>[0-9]{2})/","description":"Contiene información de indicadores económicos, energéticos y financieros."}
{"code":"afac", "visibility": "public","name_pattern":"(?P<kind>afac)(?P<name_month>[0-9]{2}).(?P<ext_versioned>[a-zA-Z0-9]+)","location_pattern":"/RUTA/PUBLICA/DEL/FTP/(?P<location_year>[0-9]{4})-(?P<location_month>[0-9]{2})/","description":"Muestra para cada uno de los agentes, todos los conceptos de la liquidación del Mercado Colombiano, con los cuales se pueden consolidar las Compras y Ventas Totales del Agente para un proceso de liquidación o ajuste mensual."}
{"code":"tserv", "visibility": "public","name_pattern":"(?P<kind>tserv)(?P<name_month>[0-9]{2}).(?P<ext_versioned>[a-zA-Z0-9]+)","location_pattern":"/RUTA/PUBLICA/DEL/FTP/(?P<location_year>[0-9]{4})-(?P<location_month>[0-9]{2})/","description":"Contiene el soporte a la liquidación de servicios CND, s y FAZNI."}
{"code":"ptb", "visibility": "public", "name_pattern":"(?P<kind>ptb)(?P<name_month>[0-9]{2})(?P<name_day>[0-9]{2}).(?P<ext_versioned>[a-zA-Z0-9]+)","location_pattern":"/RUTA/PUBLICA/DEL/FTP/(?P<location_year>[0-9]{4})-(?P<location_month>[0-9]{2})/","description":"El PTB considera tres techos en las transacciones en bolsa cuando el precio de bolsa es mayor a cualquiera de los precios de escasez."}
{"code":"PTB", "visibility": "public", "name_pattern":"(?P<kind>PTB)(?P<name_month>[0-9]{2})(?P<name_day>[0-9]{2}).(?P<ext_versioned>[a-zA-Z0-9]+)","location_pattern":"/RUTA/PUBLICA/DEL/FTP/(?P<location_year>[0-9]{4})-(?P<location_month>[0-9]{2})/","description":"El PTB considera tres techos en las transacciones en bolsa cuando el precio de bolsa es mayor a cualquiera de los precios de escasez."}
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@
"version": "003",
"agent": "xxxc",
},
"ptb": {
"PTB": {
"path": "/RUTA/PUBLICA/DEL/FTP/2025-04/PTB0401.txf",
"kind": "ptb",
"kind": "PTB",
"visibility": "public",
"year": 2025,
"month": 4,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_adem.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ def test_adem_read(adem_file: ADEM, local_adem_file):
@TESTFILES
def test_adem_preprocess(adem_file: ADEM, local_adem_file):
long_data = adem_file.preprocess(local_adem_file)
assert len(long_data) == 1128
print(len(long_data))
assert len(long_data) == 1536
2 changes: 1 addition & 1 deletion tests/test_ptb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@fixture
def ptb_remote_path():
ptb_path = ALL_FILES["ptb"]["path"]
ptb_path = ALL_FILES["PTB"]["path"]
path = pathlib.PureWindowsPath(ptb_path)
return path

Expand Down