Vai al contenuto

Aggiungere una fonte dati

Le fonti attuali sono template iniziali. Per aggiungere un'altra fonte ufficiale o aperta, copiare il blocco piu simile in configs/sources.yml, cambiare ID e dettagli di accesso, poi eseguire l'ingest.

Procedura

  1. Trovare una URL ufficiale, API, collezione STAC, endpoint SPARQL o tabella BFS PX-Web.
  2. Scegliere il tipo di connettore.
  3. Aggiungere un blocco sotto sources: in configs/sources.yml.
  4. Verificare con python scripts/ingest.py --list.
  5. Eseguire python scripts/ingest.py --source your_source_id.
  6. Controllare data/raw/your_source_id/<timestamp>/payload.* e metadata.json.

Tipi di connettore

Caso Tipo Esempio da copiare
File diretto CSV, HTML, PDF http_file sfoe_energy_balance_csv
API JSON semplice http_json parliament_affairs
API JSON con POST body http_post_json aramis_armasuisse_research_projects
Package CKAN opendata.swiss ckan_package_show opendata_swiss
Collezione STAC stac_collection meteo_swiss_smn
SPARQL JSON sparql fedlex
SPARQL CSV sparql_csv lindas
BFS PX-Web pxweb_query bfs_pxweb

Esempio minimo

my_csv_source:
  source_name: My official CSV source
  enabled: true
  type: http_file
  format: CSV
  url: https://example.admin.ch/data.csv
  suffix: csv
  documentation:
    url: https://example.admin.ch
    access_path: Direct CSV download
    license_or_terms: Check official terms
    geographic_reference: Switzerland / dataset dependent
    update_logic: Dataset dependent

Poi:

python scripts/ingest.py --source my_csv_source

Il file metadata.json deve sempre documentare origine, percorso di accesso, licenza, riferimento geografico e logica di aggiornamento.