Skip to main content

Imports

Hospital CSV Imports

Use the hospital importer for any CSV or list that means "this person appears on a hospital list." CSV formats vary, so map columns explicitly instead of adding one-off parsers.

Rules:

  • Always start with --dry-run.
  • Imports always use source = hospital_list and reporter_name = Lista hospitalaria.
  • The hospital must exist in app/lib/constants.ts; unknown hospitals fail until name, phone, and aliases are added.
  • Deduplication is by normalized national ID first; without ID, it is by hospital plus normalized full name.
  • Use --hospital-name when the CSV has no hospital column.
  • Rerun with --remote only after the preview looks right.
bun scripts/import-hospital-persons.ts \
--csv "/path/to/lista.csv" \
--dry-run \
--hospital-name "Hospital Dr. Miguel Perez Carreno" \
--name-column apellidos_nombres \
--name-order last-first \
--origin-column procedencia \
--number-column pagina \
--notes-column ya_registrado \
--observations-column resaltado

Mapping flags:

--hospital-column
--name-column
--first-name-column
--last-name-column
--national-id-column
--age-column
--gender-column
--status-column
--deceased-column
--section-column
--origin-column
--number-column
--bed-column
--phone-column
--address-column
--observations-column
--notes-column
--name-order first-last|last-first

Resource Imports

Resources are read-only in the app and API. Add or update them through a reviewed JSON import so country, type, and link handles are validated before D1 writes.

bun scripts/import-resources.ts \
--json resources.json \
--add \
--country VE \
--type website \
--name "Nombre" \
--description "Descripcion breve" \
--link website,"Sitio web",https://example.com \
--meta source=https://example.com \
--meta reviewed_at=2026-06-26

bun scripts/import-resources.ts --json resources.json
bun scripts/import-resources.ts --json resources.json --apply
bun scripts/import-resources.ts --json resources.json --apply --remote

Each JSON row stores country and type as handles, plus ordered links with type, label, and value.