Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajouter les règlements d'urbanisme de Saint-Sauveur #31

Merged
merged 4 commits into from
Jul 25, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,18 @@ jobs:
done
done
alexi -v download -u https://vsadm.ca/citoyens/reglementation/reglementation-durbanisme/ -o download/vsadm --all-pdf-links
alexi -v download -u https://www.vss.ca/services-aux-citoyens/services/reglementation-durbanisme/ \
-o download/vss --all-pdf-links -x '[Aa]nnexe'
- name: Extract
run: |
alexi -v extract -m download/index.json download/*.pdf
alexi -v extract -m download/vsadm/index.json -o export/vsadm download/vsadm/*.pdf
alexi -v extract -m download/vss/index.json -o export/vss download/vss/*.pdf
- name: Index
run: |
alexi -v index -o export/_idx export
alexi -v index -o export/vsadm/_idx export/vsadm
alexi -v index -o export/vss/_idx export/vss
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
Expand Down
15 changes: 11 additions & 4 deletions alexi/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.add_argument(
"--csv", help="Fichier CSV corriger pour mettre à jour la visualisation"
)
parser.add_argument("--force", help="Réécrire le fichier CSV même si existant")
parser.add_argument("doc", help="Document en PDF", type=Path)
parser.add_argument("out", help="Nom de base des fichiers de sortie", type=Path)
return parser
Expand Down Expand Up @@ -136,14 +137,20 @@ def main(args: argparse.Namespace) -> None:
"""Ajouter des anotations à un PDF selon l'extraction ALEXI"""
pages = [int(x.strip()) for x in args.pages.split(",")]
pages.sort()
maybe_csv = args.out.with_suffix(".csv")
if args.csv is None:
if maybe_csv.exists() and not args.force:
LOGGER.warning(
"Utilisation du fichier CSV déjà existant: %s "
"(pour réecrire ajouter --force)",
args.csv,
)
args.csv = maybe_csv
if args.csv is not None:
with open(args.csv, "rt", encoding="utf-8-sig") as infh:
iob = list(csv.DictReader(infh))
else:
args.csv = args.out.with_suffix(".csv")
if args.csv.exists():
LOGGER.error("Fichier déjà existant: %s", args.csv)
return
args.csv = maybe_csv
if args.segment_model is not None:
crf = Segmenteur(args.segment_model)
crf_n = crf
Expand Down
2 changes: 2 additions & 0 deletions alexi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def main(args: argparse.Namespace) -> None:
soup = BeautifulSoup(infh, "lxml")
if args.all_pdf_links:
for a in soup.find_all("a"):
if "href" not in a.attrs:
continue
path = a["href"]
if path.lower().endswith(".pdf"):
paths.append(path)
Expand Down
Binary file modified alexi/models/crf.joblib.gz
Binary file not shown.
Binary file modified alexi/models/crf.vl.joblib.gz
Binary file not shown.
Binary file modified alexi/models/crfseq.joblib.gz
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
737 changes: 737 additions & 0 deletions data/patches/vss_cond_patch1.csv

Large diffs are not rendered by default.

772 changes: 772 additions & 0 deletions data/patches/vss_conditions_patch1.csv

Large diffs are not rendered by default.

1,370 changes: 1,370 additions & 0 deletions data/patches/vss_dem_patch1.csv

Large diffs are not rendered by default.

976 changes: 976 additions & 0 deletions data/patches/vss_piia_patch1.csv

Large diffs are not rendered by default.

456 changes: 456 additions & 0 deletions data/patches/vss_ppcmoi_patch1.csv

Large diffs are not rendered by default.

1,812 changes: 1,812 additions & 0 deletions data/patches/vss_zonage_patch1.csv

Large diffs are not rendered by default.

1,419 changes: 1,419 additions & 0 deletions data/patches/vss_zonage_patch2.csv

Large diffs are not rendered by default.

Loading