Skip to content

chipap-dev/lanchas

Repository files navigation

Lanchas - Horarios del Delta del Tigre

CI

A Django app that scrapes, parses, and serves the official passenger-boat schedules for the Tigre Delta (Argentina) as a searchable, mobile-friendly timetable (with a BigQuery + dbt + Airflow layer behind it for analytics).

Dockerized, with real pre-loaded data. docker compose up and go.


What it does

  • Parses official government PDF schedules for 3 boat companies with pdfplumber (table extraction, color-coded direction detection, footnote matching)
  • Normalizes source data into a relational model: companies → lines → services → stops → timetable rows
  • Resolves holiday schedules against Argentina's official calendar
  • "Today" view, weekly schedule per direction, JS-free accordion navigation
  • Local favorites via localStorage, no accounts needed

Data pipeline

Government PDFs → parser/loader → Postgres → BigQuery (raw) → dbt → star schema
  • Postgres is the source of truth; a management command flattens it into lanchas_raw.horarios for BigQuery
  • dbt models a star schema: dim_empresa, dim_linea, dim_via, dim_tipo_diafact_horario (grain: one row per horario × vía)
  • 31 dbt tests (not_null, unique, accepted_values, relationships), all green
  • Full-refresh load, run monthly by Airflow: fetch → load → dbt rundbt test

Airflow DAG run dbt lineage graph dbt docs: fact_horario model

See dbt_lanchas/README.md for the full dbt setup.


Stack

Python 3.11 · Django 4.2 · PostgreSQL 16 · pdfplumber · Docker · pytest + GitHub Actions

Data layer: BigQuery · dbt · Airflow


Architecture

lanchas/
├── models/         # Empresa → Linea → Servicio → Horario, Via, Feriado
├── pipeline/       # downloader.py, loader.py
├── services/
│   ├── parsers/         # one parser per company
│   ├── feriados.py      # holiday resolution
│   ├── horarios.py      # query helpers
│   └── bigquery_export.py
└── management/commands/

tests/              # pytest, synthetic PDFs, parser edge cases
dbt_lanchas/         # star schema on lanchas_raw.horarios
airflow_dags/         # lanchas_dag.py

Run locally (Docker)

git clone https://github.com/chipap-dev/lanchas.git
cd lanchas
cp .env.example .env
docker compose up --build

Open http://localhost:8000: first boot loads real, pre-parsed schedule data automatically.

To run the live scrape-and-parse pipeline instead:

docker compose exec web python manage.py lanchas_actualizar

To run the BigQuery + dbt layer, see dbt_lanchas/README.md.


Testing

pip install -r requirements_lanchas_dev.txt
pytest -v -m "not smoke" --cov=lanchas.services.parsers --cov-report=term-missing

CI runs the full suite on every push to main; a weekly cron re-parses the live PDFs to catch upstream format changes.


Built by Claudia Cáceres · LinkedIn · Buenos Aires, Argentina

About

Tigre Delta boat timetables: government PDFs parsed with pdfplumber, normalized into PostgreSQL, modeled as a dbt star schema on BigQuery.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages