Compare commits
6 Commits
v0.3.2
...
406b89fea1
Author | SHA1 | Date | |
---|---|---|---|
406b89fea1 | |||
812d392720 | |||
6b77980e6c | |||
90c2d3689b | |||
f9be31c090 | |||
2761c3ed7b |
15
.drone.yml
15
.drone.yml
@@ -12,7 +12,7 @@ steps:
|
|||||||
image: python:3.11
|
image: python:3.11
|
||||||
commands:
|
commands:
|
||||||
- echo ${DRONE_TAG}
|
- echo ${DRONE_TAG}
|
||||||
- sed -i "s/VERSION_PLACEHOLDER/${DRONE_TAG}/g" pyproject.toml
|
- sed -i 's/version = "[^"]*"/version = "${DRONE_TAG}"/g' pyproject.toml
|
||||||
- curl -sSL https://install.python-poetry.org | python3 -
|
- curl -sSL https://install.python-poetry.org | python3 -
|
||||||
- export PATH="/root/.local/bin:$PATH"
|
- export PATH="/root/.local/bin:$PATH"
|
||||||
- poetry --version
|
- poetry --version
|
||||||
@@ -22,6 +22,19 @@ steps:
|
|||||||
PYPI_TOKEN:
|
PYPI_TOKEN:
|
||||||
from_secret: pypi_token
|
from_secret: pypi_token
|
||||||
|
|
||||||
|
- name: Notify on matrix
|
||||||
|
image: plugins/matrix
|
||||||
|
environment:
|
||||||
|
MATRIX_ROOMID:
|
||||||
|
from_secret: MATRIX_ROOMID
|
||||||
|
MATRIX_ACCESSTOKEN:
|
||||||
|
from_secret: MATRIX_ACCESSTOKEN
|
||||||
|
MATRIX_USERID:
|
||||||
|
from_secret: MATRIX_USERID
|
||||||
|
settings:
|
||||||
|
homeserver: https://matrix.poneyworld.net
|
||||||
|
template: "Une nouvelle version (${DRONE_TAG}) de pdf-oralia est publiée!"
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
include:
|
include:
|
||||||
|
@@ -17,6 +17,7 @@ DF_TYPES = {
|
|||||||
"annee": str,
|
"annee": str,
|
||||||
"lot": str,
|
"lot": str,
|
||||||
}
|
}
|
||||||
|
DEFAULT_FOURNISSEUR = "ROSIER MODICA MOTTEROZ SA"
|
||||||
|
|
||||||
|
|
||||||
def is_it(page_text):
|
def is_it(page_text):
|
||||||
@@ -62,8 +63,8 @@ def extract(table, additionnal_fields: dict = {}):
|
|||||||
for k, v in additionnal_fields.items():
|
for k, v in additionnal_fields.items():
|
||||||
r[k] = v
|
r[k] = v
|
||||||
|
|
||||||
if "honoraire" in row[RECAPITULATIF_DES_OPERATIONS]:
|
if "honoraire" in row[RECAPITULATIF_DES_OPERATIONS].lower():
|
||||||
r["Fournisseur"] = "IMI GERANCE"
|
r["Fournisseur"] = DEFAULT_FOURNISSEUR
|
||||||
|
|
||||||
extracted.append(r)
|
extracted.append(r)
|
||||||
|
|
||||||
@@ -83,6 +84,5 @@ def table2df(tables):
|
|||||||
df = pd.concat(dfs)
|
df = pd.concat(dfs)
|
||||||
|
|
||||||
df["immeuble"] = df["immeuble"].apply(lambda x: x[0].capitalize())
|
df["immeuble"] = df["immeuble"].apply(lambda x: x[0].capitalize())
|
||||||
print(df.columns)
|
|
||||||
df["lot"] = df["RECAPITULATIF DES OPERATIONS"].apply(get_lot)
|
df["lot"] = df["RECAPITULATIF DES OPERATIONS"].apply(get_lot)
|
||||||
return df.astype(DF_TYPES, errors="ignore")
|
return df.astype(DF_TYPES)
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
DF_TYPES = {
|
DF_TYPES = {
|
||||||
@@ -33,7 +34,7 @@ def is_drop(row):
|
|||||||
|
|
||||||
|
|
||||||
def extract(table, additionnal_fields: dict = {}):
|
def extract(table, additionnal_fields: dict = {}):
|
||||||
"""Turn table to dictionary with additionnal fields"""
|
"""Turn table to dictionary with additional fields"""
|
||||||
extracted = []
|
extracted = []
|
||||||
header = table[0]
|
header = table[0]
|
||||||
for row in table[1:]:
|
for row in table[1:]:
|
||||||
@@ -138,8 +139,6 @@ def join_row(table):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
joined.append(row)
|
joined.append(row)
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return joined
|
return joined
|
||||||
|
|
||||||
@@ -159,4 +158,9 @@ def table2df(tables):
|
|||||||
df["immeuble"] = df["immeuble"].apply(lambda x: x[0].capitalize())
|
df["immeuble"] = df["immeuble"].apply(lambda x: x[0].capitalize())
|
||||||
df["Type"] = df["Type"].apply(clean_type)
|
df["Type"] = df["Type"].apply(clean_type)
|
||||||
|
|
||||||
return df.astype(DF_TYPES, errors="ignore")
|
numeric_cols = [k for k, v in DF_TYPES.items() if v == float]
|
||||||
|
df[numeric_cols] = df[numeric_cols].replace("", np.nan)
|
||||||
|
|
||||||
|
df = df.drop(df[(df["Locataires"] == "") & (df["Période"] == "")].index)
|
||||||
|
|
||||||
|
return df.astype(DF_TYPES)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pdf-oralia"
|
name = "pdf-oralia"
|
||||||
version = "1.dev"
|
version = "dev"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Bertrand Benjamin <benjamin.bertrand@opytex.org>"]
|
authors = ["Bertrand Benjamin <benjamin.bertrand@opytex.org>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
Reference in New Issue
Block a user