diff --git a/CI/prepare_documentation_precommit.sh b/CI/prepare_documentation_precommit.sh new file mode 100755 index 0000000000000000000000000000000000000000..373e6ba4a7b7028451aea47ee53bb0f5309160dd --- /dev/null +++ b/CI/prepare_documentation_precommit.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# get information from automatic documentation, +curl "http://127.0.0.1:8000/openapi.json" > toardb_fastapi.yaml +# prepare documentation for pages +python3 prepare_openapi_json.py toardb_fastapi.yaml +# convert OpenAPI format to Markdown +openapi-markdown --skip-info -i sample.json + +# last pretty print changes for pages +( +cat <<'EOF' +# TOAR II Database + +### Models + +EOF +) > sample_header.md +( +cat <<'EOF' + + +## REST API + +EOF +) > sample_rest_header.md +sed '1,/^### Models$/d' sample.md >sample_models.md +sed '/^### Models$/Q' sample.md >sample_rest.md + +cat sample_header.md sample_models.md sample_rest_header.md sample_rest.md >../docs/toardb_fastapi.md +rm sample* toardb_fastapi.yaml diff --git a/CI/prepare_openapi_json.py b/CI/prepare_openapi_json.py new file mode 100644 index 0000000000000000000000000000000000000000..5a3a9b5a669d23d8947348f3b579facaeb2438db --- /dev/null +++ b/CI/prepare_openapi_json.py @@ -0,0 +1,32 @@ +import sys +import json +from copy import deepcopy + +if len(sys.argv) == 2: + with open(sys.argv[1]) as f: + fastapi = json.load(f) + + # do not show "post" commands in user documentation + paths = deepcopy(fastapi['paths']) + for path in fastapi['paths'].keys(): + for key in fastapi['paths'][path].keys(): + if (key == 'post'): + paths[path].pop(key) + + # do not show "create" objects in user documentation + schemas = fastapi['components']['schemas'].copy() + for key in fastapi['components']['schemas'].keys(): + if (('create' in key.lower()) or ('error' in key.lower())): + schemas.pop(key) + # Serializing json + fastapi['paths'] = paths + fastapi['components']['schemas'] = schemas + json_object = json.dumps(fastapi, indent = 4) + + # Writing to sample.json + with open("sample.json", "w") as outfile: + outfile.write(json_object) + +else: + print("ERROR: start script with: python3 prepare_openapi_json.py filename") + diff --git a/docs/index.rst b/docs/index.rst index faa33f26984f15f28d81422bc4a3a255b5d74964..627b89df9ddee75334c659da46efd42329599214 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,13 +7,12 @@ Welcome to toar_db's documentation! =================================== .. toctree:: - :maxdepth: 5 + :maxdepth: 3 - oldDB toardb_fastapi - newDB - global_data_sources + oldDB + global_data_sources Indices and tables diff --git a/docs/toardb_fastapi.md b/docs/toardb_fastapi.md deleted file mode 120000 index 0fe74b8a9adc603294f0750c5a56552d23220f77..0000000000000000000000000000000000000000 --- a/docs/toardb_fastapi.md +++ /dev/null @@ -1 +0,0 @@ -../toardb_fastapi.md \ No newline at end of file diff --git a/docs/toardb_fastapi.md b/docs/toardb_fastapi.md new file mode 100644 index 0000000000000000000000000000000000000000..6cefa42578521609e24206f307825beae4bff833 --- /dev/null +++ b/docs/toardb_fastapi.md @@ -0,0 +1,620 @@ +# TOAR II Database + +### Models + + + +#### Contact + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| person | [Person](#person) | | Yes | +| organisation | [Organisation](#organisation) | | Yes | + +#### Coordinates + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| lat | number | | No | +| lng | number | | No | +| alt | number | | Yes | + +#### Data + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| datetime | dateTime | | Yes | +| value | number | | Yes | +| flags | string | | Yes | +| timeseries_id | integer | | Yes | + +#### Organisation + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| name | string | Short name (abbreviation) of organisation | Yes | +| longname | string | Long name of organisation | Yes | +| kind | string | Kind of organisation | Yes | +| city | string | City where organisation resides | Yes | +| postcode | string | Postcode of organisation city | Yes | +| street_address | string | Street address of organisation city | Yes | +| country | string | Country to which organisation belongs | Yes | +| homepage | string | Homepage of organisation | Yes | + +#### Person + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| name | string | Name of person | Yes | +| email | string | Email address of person | Yes | +| phone | string | Phone number of person | Yes | +| isprivate | boolean | Set this flag to true if the contact details shall not be exposed publicly | Yes | + +#### Stationmeta + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| codes | [ string ] | | No | +| name | string | | Yes | +| coordinates | [Coordinates](#coordinates) | | Yes | +| country | string | | Yes | +| state | string | | Yes | +| coordinate_validation_status | string | | Yes | +| coordinate_validation_date | dateTime | | Yes | +| type_of_environment | string | | Yes | +| type_of_area | string | | Yes | +| timezone | string | | Yes | +| additional_metadata | string (json-string) | | No | +| coordinate_validator_id | integer | | Yes | +| roles | [ [StationmetaRole](#stationmetarole) ] | | No | +| annotations | [ [StationmetaAnnotation](#stationmetaannotation) ] | | No | +| aux_images | [ [StationmetaAuxImage](#stationmetaauximage) ] | | No | +| aux_docs | [ [StationmetaAuxDoc](#stationmetaauxdoc) ] | | No | +| aux_urls | [ [StationmetaAuxUrl](#stationmetaauxurl) ] | | No | +| globalmeta | [StationmetaGlobal](#stationmetaglobal) | | No | +| globalservice | [StationmetaGlobalService](#stationmetaglobalservice) | | No | + +#### StationmetaAnnotation + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| kind | integer | | Yes | +| text | string | | Yes | +| date_added | dateTime | | Yes | +| approved | boolean | | Yes | +| contributor_id | integer | | Yes | + +#### StationmetaAuxDoc + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| resource_description | string | | Yes | +| date_added | dateTime | | Yes | +| resource | string | | Yes | +| station_id | integer | | Yes | + +#### StationmetaAuxImage + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| resource_description | string | | Yes | +| date_added | dateTime | | Yes | +| resource | string | | Yes | +| image_height | integer | | Yes | +| image_width | integer | | Yes | +| station_id | integer | | Yes | + +#### StationmetaAuxUrl + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| resource_description | string | | Yes | +| date_added | dateTime | | Yes | +| resource | string | | Yes | +| station_id | integer | | Yes | + +#### StationmetaCore + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| codes | [ string ] | | No | +| name | string | | Yes | +| coordinates | [Coordinates](#coordinates) | | Yes | +| country | string | | Yes | +| state | string | | Yes | +| coordinate_validation_status | string | | Yes | +| coordinate_validation_date | dateTime | | Yes | +| type_of_environment | string | | Yes | +| type_of_area | string | | Yes | +| timezone | string | | Yes | +| additional_metadata | string (json-string) | | No | +| coordinate_validator_id | integer | | Yes | + +#### StationmetaGlobal + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| population_density_year2010 | number | | Yes | +| max_population_density_25km_year2010 | number | | Yes | +| climatic_zone | string | | Yes | +| nightlight_1km_year2013 | number | | Yes | +| nightlight_5km_year2013 | number | | Yes | +| max_nightlight_25km_year2013 | number | | Yes | +| wheat_production_year2000 | number | | Yes | +| rice_production_year2000 | number | | Yes | +| edgar_htap_v2_nox_emissions_year2010 | number | | Yes | +| omi_no2_column_years2011to2015 | number | | Yes | +| htap_region_tier1 | string | | Yes | +| etopo_alt | number | | Yes | +| etopo_min_alt_5km | number | | Yes | +| etopo_relative_alt | number | | Yes | +| dominant_landcover_year2012 | string | | Yes | +| toar1_category | string | | Yes | +| station_id | integer | | Yes | + +#### StationmetaGlobalService + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| variable_name | string | | Yes | +| result_type | integer | | Yes | +| result_nvalues | integer | | Yes | +| service_valid_year | integer | | Yes | +| service_url | string | | Yes | + +#### StationmetaRole + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| role | string | | Yes | +| status | string | | Yes | +| contact_id | integer | | Yes | + +#### Timeseries + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| label | string | a short string to distinguish this timeseries from others with the same combination of station and variable | Yes | +| order | integer | indicates position of this timeseries in a list when several timeseries share the same station and variable combination | Yes | +| access_rights | string | Access rights of timeseries data | Yes | +| sampling_frequency | string | Sampling frequency of data in this timeseries | Yes | +| aggregation | string | Aggregation type in this timeseries | Yes | +| source | string | | Yes | +| data_start_date | dateTime | Start date of the variable data available for this station | Yes | +| data_end_date | dateTime | End date of the variable data available for this station | Yes | +| measurement_method | string | instrument principle of measurement | Yes | +| sampling_height | number | Height above the ground of the inlet/instrument/sampler (in m) | Yes | +| date_added | dateTime | Date of timeseries metadata entry into TOAR database | Yes | +| date_modified | dateTime | Date of last timeseries metadata modification | Yes | +| additional_metadata | string (json-string) | Additional information about the timeseries as JSON structure. | Yes | +| roles | [ [TimeseriesRole](#timeseriesrole) ] | | No | +| annotations | [ [TimeseriesAnnotation](#timeseriesannotation) ] | | No | +| variable | [Variable](#variable) | | Yes | +| station | | | No | +| programme | [TimeseriesProgramme](#timeseriesprogramme) | | Yes | + +#### TimeseriesAnnotation + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| kind | integer | | Yes | +| text | string | | Yes | +| date_added | dateTime | | Yes | +| approved | boolean | | Yes | +| contributor_id | integer | | Yes | +| timeseries_id | integer | | Yes | + +#### TimeseriesProgramme + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| name | string | | Yes | +| longname | string | | Yes | +| homepage | string | | Yes | +| description | string | | Yes | + +#### TimeseriesRole + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | integer | | Yes | +| role | string | | Yes | +| status | string | | Yes | +| contact_id | integer | | Yes | + +#### Variable + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| name | string | Name. Short variable-like name of the variable | Yes | +| longname | string | Longname. Long (explicit) name of the variable | Yes | +| displayname | string | Displayname. Display name of the variable | Yes | +| cf_standardname | string | Cf standardname. CF standard name of the variable if defined | Yes | +| units | string | Units. Physical units of variable | Yes | +| chemical_formula | string | Chemical formula. Chemical formula of variable(if applicable) | Yes | +| id | integer | | Yes | + +## REST API + +### /variables/ + +#### GET +##### Summary: + +Get Variables + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /variables/{name} + +#### GET +##### Summary: + +Get Variable + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| name | path | | Yes | string | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /variables/id/{variable_id} + +#### GET +##### Summary: + +Get Variable + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| variable_id | path | | Yes | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/persons/ + +#### GET +##### Summary: + +Get All Persons + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/persons/id/{person_id} + +#### GET +##### Summary: + +Get Person + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| person_id | path | | Yes | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/persons/{name} + +#### GET +##### Summary: + +Get Person + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| name | path | | Yes | string | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/organisations/ + +#### GET +##### Summary: + +Get All Organisations + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/organisations/id/{organisation_id} + +#### GET +##### Summary: + +Get Organisation + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| organisation_id | path | | Yes | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/organisations/{name} + +#### GET +##### Summary: + +Get Organisation + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| name | path | | Yes | string | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /contacts/ + +#### GET +##### Summary: + +Get All Contacts + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /stationmeta_core/ + +#### GET +##### Summary: + +Get All Stationmeta Core + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /stationmeta/ + +#### GET +##### Summary: + +Get All Stationmeta + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /stationmeta_core/{station_code} + +#### GET +##### Summary: + +Get Stationmeta Core + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| station_code | path | | Yes | string | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /stationmeta/{station_code} + +#### GET +##### Summary: + +Get Stationmeta + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| station_code | path | | Yes | string | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /timeseries/ + +#### GET +##### Summary: + +Get All Timeseries + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /timeseries/{timeseries_id} + +#### GET +##### Summary: + +Get Timeseries + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| timeseries_id | path | | Yes | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /data/ + +#### GET +##### Summary: + +Get All Data + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| skip | query | | No | integer | +| limit | query | | No | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + +### /data/{timeseries_id} + +#### GET +##### Summary: + +Get Data + +##### Parameters + +| Name | Located in | Description | Required | Schema | +| ---- | ---------- | ----------- | -------- | ---- | +| timeseries_id | path | | Yes | integer | + +##### Responses + +| Code | Description | +| ---- | ----------- | +| 200 | Successful Response | +| 422 | Validation Error | + diff --git a/toardb_fastapi.md b/toardb_fastapi.md deleted file mode 100644 index 8ac9a5f53785b4c50615a54aec12a34665acaa1c..0000000000000000000000000000000000000000 --- a/toardb_fastapi.md +++ /dev/null @@ -1,866 +0,0 @@ -# FastAPI -## Version: 0.1.0 - -### /variables/ - -#### GET -##### Summary: - -Get Variables - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Variable - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /variables/{name} - -#### GET -##### Summary: - -Get Variable - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| name | path | | Yes | string | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /variables/id/{variable_id} - -#### GET -##### Summary: - -Get Variable - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| variable_id | path | | Yes | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/persons/ - -#### GET -##### Summary: - -Get All Persons - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Person - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/persons/id/{person_id} - -#### GET -##### Summary: - -Get Person - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| person_id | path | | Yes | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/persons/{name} - -#### GET -##### Summary: - -Get Person - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| name | path | | Yes | string | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/organisations/ - -#### GET -##### Summary: - -Get All Organisations - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Organisation - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/organisations/id/{organisation_id} - -#### GET -##### Summary: - -Get Organisation - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| organisation_id | path | | Yes | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/organisations/{name} - -#### GET -##### Summary: - -Get Organisation - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| name | path | | Yes | string | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /contacts/ - -#### GET -##### Summary: - -Get All Contacts - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /stationmeta_core/ - -#### GET -##### Summary: - -Get All Stationmeta Core - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /stationmeta/ - -#### GET -##### Summary: - -Get All Stationmeta - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Stationmeta Core - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /stationmeta_core/{station_code} - -#### GET -##### Summary: - -Get Stationmeta Core - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| station_code | path | | Yes | string | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /stationmeta/{station_code} - -#### GET -##### Summary: - -Get Stationmeta - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| station_code | path | | Yes | string | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /timeseries/ - -#### GET -##### Summary: - -Get All Timeseries - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Timeseries - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /timeseries/{timeseries_id} - -#### GET -##### Summary: - -Get Timeseries - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| timeseries_id | path | | Yes | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /data/ - -#### GET -##### Summary: - -Get All Data - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| skip | query | | No | integer | -| limit | query | | No | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -#### POST -##### Summary: - -Create Data - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### /data/{timeseries_id} - -#### GET -##### Summary: - -Get Data - -##### Parameters - -| Name | Located in | Description | Required | Schema | -| ---- | ---------- | ----------- | -------- | ---- | -| timeseries_id | path | | Yes | integer | - -##### Responses - -| Code | Description | -| ---- | ----------- | -| 200 | Successful Response | -| 422 | Validation Error | - -### Models - - -#### Body_create_data_data__post - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| file | binary | | Yes | - -#### Body_create_organisation_contacts_organisations__post - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| organisation | [OrganisationCreate](#organisationcreate) | | Yes | - -#### Body_create_person_contacts_persons__post - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| person | [PersonCreate](#personcreate) | | Yes | - -#### Body_create_stationmeta_core_stationmeta__post - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| stationmeta | [StationmetaCreate](#stationmetacreate) | | Yes | - -#### Body_create_timeseries_timeseries__post - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| timeseries | [TimeseriesCreate](#timeseriescreate) | | Yes | - -#### Contact - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| person | [Person](#person) | | Yes | -| organisation | [Organisation](#organisation) | | Yes | - -#### Coordinates - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| lat | number | | No | -| lng | number | | No | -| alt | number | | Yes | - -#### Data - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| datetime | dateTime | | Yes | -| value | number | | Yes | -| flags | string | | Yes | -| timeseries_id | integer | | Yes | - -#### DataCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| datetime | dateTime | | Yes | -| value | number | | Yes | -| flags | string | | Yes | -| timeseries_id | integer | | Yes | - -#### HTTPValidationError - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| detail | [ [ValidationError](#validationerror) ] | | No | - -#### Organisation - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| name | string | Short name (abbreviation) of organisation | Yes | -| longname | string | Long name of organisation | Yes | -| kind | string | Kind of organisation | Yes | -| city | string | City where organisation resides | Yes | -| postcode | string | Postcode of organisation city | Yes | -| street_address | string | Street address of organisation city | Yes | -| country | string | Country to which organisation belongs | Yes | -| homepage | string | Homepage of organisation | Yes | - -#### OrganisationCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| name | string | Short name (abbreviation) of organisation | Yes | -| longname | string | Long name of organisation | Yes | -| kind | string | | Yes | -| city | string | City where organisation resides | Yes | -| postcode | string | Postcode of organisation city | Yes | -| street_address | string | Street address of organisation city | Yes | -| country | string | Country to which organisation belongs | Yes | -| homepage | string | Homepage of organisation | Yes | - -#### Person - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| name | string | Name of person | Yes | -| email | string | Email address of person | Yes | -| phone | string | Phone number of person | Yes | -| isprivate | boolean | Set this flag to true if the contact details shall not be exposed publicly | Yes | - -#### PersonCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| name | string | Name of person | Yes | -| email | string | Email address of person | Yes | -| phone | string | Phone number of person | Yes | -| isprivate | boolean | Set this flag to true if the contact details shall not be exposed publicly | Yes | - -#### Stationmeta - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| codes | [ string ] | | No | -| name | string | | Yes | -| coordinates | [Coordinates](#coordinates) | | Yes | -| country | string | | Yes | -| state | string | | Yes | -| coordinate_validation_status | string | | Yes | -| coordinate_validation_date | dateTime | | Yes | -| type_of_environment | string | | Yes | -| type_of_area | string | | Yes | -| timezone | string | | Yes | -| additional_metadata | string (json-string) | | No | -| coordinate_validator_id | integer | | Yes | -| roles | [ [StationmetaRole](#stationmetarole) ] | | No | -| annotations | [ [StationmetaAnnotation](#stationmetaannotation) ] | | No | -| aux_images | [ [StationmetaAuxImage](#stationmetaauximage) ] | | No | -| aux_docs | [ [StationmetaAuxDoc](#stationmetaauxdoc) ] | | No | -| aux_urls | [ [StationmetaAuxUrl](#stationmetaauxurl) ] | | No | -| globalmeta | [StationmetaGlobal](#stationmetaglobal) | | No | -| globalservice | [StationmetaGlobalService](#stationmetaglobalservice) | | No | - -#### StationmetaAnnotation - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| kind | integer | | Yes | -| text | string | | Yes | -| date_added | dateTime | | Yes | -| approved | boolean | | Yes | -| contributor_id | integer | | Yes | - -#### StationmetaAuxDoc - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | -| station_id | integer | | Yes | - -#### StationmetaAuxImage - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | -| image_height | integer | | Yes | -| image_width | integer | | Yes | -| station_id | integer | | Yes | - -#### StationmetaAuxUrl - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | -| station_id | integer | | Yes | - -#### StationmetaCore - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| codes | [ string ] | | No | -| name | string | | Yes | -| coordinates | [Coordinates](#coordinates) | | Yes | -| country | string | | Yes | -| state | string | | Yes | -| coordinate_validation_status | string | | Yes | -| coordinate_validation_date | dateTime | | Yes | -| type_of_environment | string | | Yes | -| type_of_area | string | | Yes | -| timezone | string | | Yes | -| additional_metadata | string (json-string) | | No | -| coordinate_validator_id | integer | | Yes | - -#### StationmetaCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| codes | [ string ] | | No | -| name | string | | Yes | -| coordinates | [Coordinates](#coordinates) | | Yes | -| country | string | | Yes | -| state | string | | Yes | -| coordinate_validation_status | string | | Yes | -| coordinate_validation_date | dateTime | | Yes | -| type_of_environment | string | | Yes | -| type_of_area | string | | Yes | -| timezone | string | | Yes | -| additional_metadata | string (json-string) | | No | -| coordinate_validator_id | integer | | Yes | -| roles | [ [StationmetaRoleBase](#stationmetarolebase) ] | | No | -| annotations | [ [StationmetaAnnotation](#stationmetaannotation) ] | | No | -| aux_images | [ [StationmetaAuxImage](#stationmetaauximage) ] | | No | -| aux_docs | [ [StationmetaAuxDoc](#stationmetaauxdoc) ] | | No | -| aux_urls | [ [StationmetaAuxUrl](#stationmetaauxurl) ] | | No | -| globalmeta | [StationmetaGlobalNestedCreate](#stationmetaglobalnestedcreate) | | No | -| globalservice | [StationmetaGlobalService](#stationmetaglobalservice) | | No | - -#### StationmetaGlobal - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| population_density_year2010 | number | | Yes | -| max_population_density_25km_year2010 | number | | Yes | -| climatic_zone | string | | Yes | -| nightlight_1km_year2013 | number | | Yes | -| nightlight_5km_year2013 | number | | Yes | -| max_nightlight_25km_year2013 | number | | Yes | -| wheat_production_year2000 | number | | Yes | -| rice_production_year2000 | number | | Yes | -| edgar_htap_v2_nox_emissions_year2010 | number | | Yes | -| omi_no2_column_years2011to2015 | number | | Yes | -| htap_region_tier1 | string | | Yes | -| etopo_alt | number | | Yes | -| etopo_min_alt_5km | number | | Yes | -| etopo_relative_alt | number | | Yes | -| dominant_landcover_year2012 | string | | Yes | -| toar1_category | string | | Yes | -| station_id | integer | | Yes | - -#### StationmetaGlobalNestedCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| population_density_year2010 | number | | No | -| max_population_density_25km_year2010 | number | | No | -| climatic_zone | string | | No | -| nightlight_1km_year2013 | number | | No | -| nightlight_5km_year2013 | number | | No | -| max_nightlight_25km_year2013 | number | | No | -| wheat_production_year2000 | number | | No | -| rice_production_year2000 | number | | No | -| edgar_htap_v2_nox_emissions_year2010 | number | | No | -| omi_no2_column_years2011to2015 | number | | No | -| htap_region_tier1 | integer | | No | -| etopo_alt | number | | No | -| etopo_min_alt_5km | number | | No | -| etopo_relative_alt | number | | No | -| dominant_landcover_year2012 | integer | | No | -| toar1_category | integer | | No | - -#### StationmetaGlobalService - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| variable_name | string | | Yes | -| result_type | integer | | Yes | -| result_nvalues | integer | | Yes | -| service_valid_year | integer | | Yes | -| service_url | string | | Yes | - -#### StationmetaRole - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| role | string | | Yes | -| status | string | | Yes | -| contact_id | integer | | Yes | - -#### StationmetaRoleBase - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| role | string | | Yes | -| status | string | | Yes | -| contact_id | integer | | Yes | - -#### Timeseries - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| label | string | a short string to distinguish this timeseries from others with the same combination of station and variable | Yes | -| order | integer | indicates position of this timeseries in a list when several timeseries share the same station and variable combination | Yes | -| access_rights | string | Access rights of timeseries data | Yes | -| sampling_frequency | string | Sampling frequency of data in this timeseries | Yes | -| aggregation | string | Aggregation type in this timeseries | Yes | -| source | string | | Yes | -| data_start_date | dateTime | Start date of the variable data available for this station | Yes | -| data_end_date | dateTime | End date of the variable data available for this station | Yes | -| measurement_method | string | instrument principle of measurement | Yes | -| sampling_height | number | Height above the ground of the inlet/instrument/sampler (in m) | Yes | -| date_added | dateTime | Date of timeseries metadata entry into TOAR database | Yes | -| date_modified | dateTime | Date of last timeseries metadata modification | Yes | -| additional_metadata | string (json-string) | Additional information about the timeseries as JSON structure. | Yes | -| roles | [ [TimeseriesRole](#timeseriesrole) ] | | No | -| annotations | [ [TimeseriesAnnotation](#timeseriesannotation) ] | | No | -| variable | [Variable](#variable) | | Yes | -| station | | | No | -| programme | [TimeseriesProgramme](#timeseriesprogramme) | | Yes | - -#### TimeseriesAnnotation - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| kind | integer | | Yes | -| text | string | | Yes | -| date_added | dateTime | | Yes | -| approved | boolean | | Yes | -| contributor_id | integer | | Yes | -| timeseries_id | integer | | Yes | - -#### TimeseriesCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| label | string | a short string to distinguish this timeseries from others with the same combination of station and variable | Yes | -| order | integer | indicates position of this timeseries in a list when several timeseries share the same station and variable combination | Yes | -| access_rights | string | Access rights of timeseries data | Yes | -| sampling_frequency | string | Sampling frequency of data in this timeseries | Yes | -| aggregation | string | Aggregation type in this timeseries | Yes | -| source | string | | Yes | -| data_start_date | dateTime | Start date of the variable data available for this station | Yes | -| data_end_date | dateTime | End date of the variable data available for this station | Yes | -| measurement_method | string | instrument principle of measurement | Yes | -| sampling_height | number | Height above the ground of the inlet/instrument/sampler (in m) | Yes | -| date_added | dateTime | Date of timeseries metadata entry into TOAR database | Yes | -| date_modified | dateTime | Date of last timeseries metadata modification | Yes | -| additional_metadata | string (json-string) | Additional information about the timeseries as JSON structure. | Yes | -| station_id | integer | | Yes | -| variable_id | integer | | Yes | -| programme_id | integer | | Yes | -| roles | [ [TimeseriesRoleCreate](#timeseriesrolecreate) ] | | No | -| annotations | [ [TimeseriesAnnotation](#timeseriesannotation) ] | | No | - -#### TimeseriesProgramme - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| name | string | | Yes | -| longname | string | | Yes | -| homepage | string | | Yes | -| description | string | | Yes | - -#### TimeseriesRole - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| role | string | | Yes | -| status | string | | Yes | -| contact | | | No | - -#### TimeseriesRoleCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| id | integer | | No | -| role | string | | Yes | -| status | string | | Yes | -| contact | | | No | - -#### ValidationError - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| loc | [ string ] | | Yes | -| msg | string | | Yes | -| type | string | | Yes | - -#### Variable - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| name | string | Name. Short variable-like name of the variable | Yes | -| longname | string | Longname. Long (explicit) name of the variable | Yes | -| displayname | string | Displayname. Display name of the variable | Yes | -| cf_standardname | string | Cf standardname. CF standard name of the variable if defined | Yes | -| units | string | Units. Physical units of variable | Yes | -| chemical_formula | string | Chemical formula. Chemical formula of variable(if applicable) | Yes | -| id | integer | | Yes | - -#### VariableCreate - -| Name | Type | Description | Required | -| ---- | ---- | ----------- | -------- | -| name | string | Name. Short variable-like name of the variable | Yes | -| longname | string | Longname. Long (explicit) name of the variable | Yes | -| displayname | string | Displayname. Display name of the variable | Yes | -| cf_standardname | string | Cf standardname. CF standard name of the variable if defined | Yes | -| units | string | Units. Physical units of variable | Yes | -| chemical_formula | string | Chemical formula. Chemical formula of variable(if applicable) | Yes | \ No newline at end of file