Visual diagram of Chile Hospital Map: hospitals, health services, beds, and D3 web app

MVP: public hospital layer → bed-capacity series → API → map and establishment profile.

Public

Chile Hospital Map

Data product for mapping Chilean public hospitals, health services, location, and annual bed capacity from 2020-2024 with reproducible ETL, API, and a D3 map.

192
SNSS public hospitals
29
health services
3,820
bed-capacity rows 2020-2024

Stack

Next.js · TypeScript · D3.js · FastAPI · Pydantic · Python · Typer · Postgres/PostGIS · Docker Compose

Artifacts

Local web/API demo; public repo and demo pending confirmation

Constraints

  • Base case written from local project documentation; public repo and demo links are pending confirmation.
  • The current regional map layer is provisional for visualization and does not participate in joins or metrics.
  • The MVP does not claim real-time availability or full coverage of the private hospital universe.

TL;DR

  • Builds a master layer of SNSS public hospitals with DEIS code, municipality, region, health service, and coordinates.
  • Integrates 2020-2024 bed capacity from the DEIS annual report using normalized matching and versioned aliases.
  • Exposes a basic API and Next.js/D3 web app with filters, map, hospital profile, and bed-capacity series.

Reusable patterns

  • Solve entity identity before accumulating indicators: DEIS code, canonical names, and health-service assignment.
  • Use versioned snapshots of unstable public sources instead of coupling the app to live downloads.
  • Keep matching reports so uncertain joins between the annual report and the master table are not forced.
  • Separate ETL, API, and Web so the hospital layer is reusable beyond the map.

Context

Chilean hospital information is scattered across geoportals, annual reports, PDFs, sector registries, and catalogs with inconsistent naming.

Putting points on a map does not solve the real problem unless there is first a longitudinal, reliable hospital layer with stable identity.

The project starts with the SNSS public network to validate a reusable base before adding emergency pressure, waitlists, accreditation, or procurement.

Decisions

  • Use the DEIS code as the preferred identifier when present, avoiding free-text names as the main integration key.
  • Version MINSAL/DEIS source snapshots and keep source_id, source_url, and snapshot_at in derived artifacts.
  • Serve the bootstrap from versioned JSON before depending on PostGIS, keeping the API contract simple while the model matures.
  • Keep the D3 map separate from data transforms: the web app consumes visualization-ready API endpoints.
  • Make MVP non-goals explicit: no real time, no full private universe, and no composite clinical score.

Architecture

Chile Hospital Map architecture: MINSAL/DEIS sources, ETL, FastAPI API, and Next.js web with D3
Official sources → snapshots → Python/Typer ETL → artifacts/DB → FastAPI → Next.js + D3.
  • The API exposes health services, regions, establishments, GeoJSON, and bed capacity by hospital.
  • The 2020-2024 bed series is parsed from table 33 of the DEIS annual report and joined to the master layer through controlled matching.
  • The target architecture is Postgres/PostGIS, but the bootstrap keeps versioned JSON artifacts to audit the initial contract.

Outcome

  • The implemented slice covers 192 SNSS public hospitals, 29 health services, and 3,820 annual bed-capacity rows for 191 matched hospitals.
  • The product turns scattered health sources into a layer that can be queried by hospital, territory, and care network.
  • The base is ready to add accreditation, emergency activity, waitlists, export, and reporting without rebuilding hospital identity.