REST API for bulk data upload was build
For harvesting data from networks, especially for OpenAQ, a bulk upload for data is needed.
At the time being, the REST API allows for uploading
- harmonized data files (from individual providers)
create_data(file: UploadFile = File(...), db: Session = Depends(get_db), engine: Engine = Depends(get_engine))
- one data_record
create_data_record(series_id: int, datetime: dt.datetime, value: float, flag: str, version: str = None, suppress_unique_violation: bool = False, db: Session = Depends(get_db), engine: Engine = Depends(get_engine))
A REST API for passing a dataframe is still missing.
The following work-around for passing a dataframe to the REST (Fast)API can be done as is described here:
https://github.com/tiangolo/fastapi/issues/1616#issuecomment-648982543
This has been realized for toardb_fastapi (conversion to json, sending, reconversion to pandas).
See commits below:
9d88772d : REST API for bulk data
toar-db-data@ccc76594 : application using the new REST API
Edited by Sabine Schröder