diff --git a/docs/toardb_fastapi_fromMD.rst b/docs/toardb_fastapi_fromMD.rst new file mode 100644 index 0000000000000000000000000000000000000000..94f97c3a5e4441495a542e6b8f41c7c8f96cb201 --- /dev/null +++ b/docs/toardb_fastapi_fromMD.rst @@ -0,0 +1,1055 @@ +TOAR II Database +================ + +Models +~~~~~~ + +Contact +^^^^^^^ + ++----------------+------------------------------------+---------------+------------+ +| Name | Type | Description | Required | ++================+====================================+===============+============+ +| person | `Person <#person>`__ | | Yes | ++----------------+------------------------------------+---------------+------------+ +| organisation | `Organisation <#organisation>`__ | | Yes | ++----------------+------------------------------------+---------------+------------+ + +Coordinates +^^^^^^^^^^^ + ++-------+-------+--------------+-----------+ +| Name | Type | Description | Required | ++=======+=======+==============+===========+ +| lat | number | longitude | No | +| | | coordinate | | +| | | of station | | +| | | (decimal | | +| | | degrees\_eas | | +| | | t). | | +| | | This is our | | +| | | best | | +| | | estimate of | | +| | | the station | | +| | | location | | +| | | which is not | | +| | | always | | +| | | identical to | | +| | | the official | | +| | | station | | +| | | coordinates | | +| | | (see | | +| | | coordinate\_ | | +| | | validation\_ | | +| | | status). | | ++-------+-------+--------------+-----------+ +| lng | number | latitude | No | +| | | coordinate | | +| | | of station | | +| | | (decimal | | +| | | degrees\_nor | | +| | | th). | | +| | | This is our | | +| | | best | | +| | | estimate of | | +| | | the station | | +| | | location | | +| | | which is not | | +| | | always | | +| | | identical to | | +| | | the official | | +| | | station | | +| | | coordinates | | +| | | (see | | +| | | coordinate\_ | | +| | | validation\_ | | +| | | status). | | ++-------+-------+--------------+-----------+ +| alt | number | altitude of | No | +| | | station (in | | +| | | m above sea | | +| | | level). This | | +| | | is our best | | +| | | estimate of | | +| | | the station | | +| | | altitude, | | +| | | which is not | | +| | | always | | +| | | identical to | | +| | | the reported | | +| | | station | | +| | | altitude, | | +| | | but | | +| | | frequently | | +| | | uses the | | +| | | elevation | | +| | | from google | | +| | | earth | | +| | | instead (see | | +| | | coordinate\_ | | +| | | validation\_ | | +| | | status). | | ++-------+-------+--------------+-----------+ + +Data +^^^^ + ++------------------+------------+--------------------------------+------------+ +| Name | Type | Description | Required | ++==================+============+================================+============+ +| datetime | dateTime | date and time of observation | Yes | ++------------------+------------+--------------------------------+------------+ +| value | number | variable value at datetime | Yes | ++------------------+------------+--------------------------------+------------+ +| flags | string | flags | Yes | ++------------------+------------+--------------------------------+------------+ +| timeseries\_id | integer | ID of timeseries | 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 ] | list of station's codes | Yes | ++----------------------------------+----------------------------------------------------------+---------------------------+------------+ +| 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 | ++----------------------------------+----------------------------------------------------------+---------------------------+------------+ + +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 ] | list of station's codes | Yes | ++----------------------------------+----------------------------------+---------------------------+------------+ +| 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 | ++---------------------------------------------+-----------+---------------+------------+ + +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/docs/toardb_v2_fromRST.pdf b/docs/toardb_v2_fromRST.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b2e71b5672f8b04b714f978be3256e53c86964fd Binary files /dev/null and b/docs/toardb_v2_fromRST.pdf differ diff --git a/toardb/data/schemas.py b/toardb/data/schemas.py index f7c9bce81f4bf5c636b2bacaf40c973169d38f0f..3e125e638a6ac446ed7d007b65f8e044df07a087 100644 --- a/toardb/data/schemas.py +++ b/toardb/data/schemas.py @@ -5,15 +5,15 @@ Pydantic schemas for TOAR database from typing import List -from pydantic import BaseModel, validator +from pydantic import BaseModel, validator, Field import datetime as dt from .models import DF_enum class DataBase(BaseModel): - datetime: dt.datetime - value: float - flags: str - timeseries_id: int + datetime: dt.datetime = Field(..., description="date and time of observation") + value: float = Field(..., description="variable value at datetime") + flags: str = Field(..., description="flags") + timeseries_id: int = Field(..., description="ID of timeseries") @validator('flags') def check_flags(cls, v): diff --git a/toardb/stationmeta/schemas.py b/toardb/stationmeta/schemas.py index f9c7828b15101bdbe8b8126cb8d013834be95561..d70c842a1b12af25b3fca892a850600eacbf4004 100644 --- a/toardb/stationmeta/schemas.py +++ b/toardb/stationmeta/schemas.py @@ -18,9 +18,9 @@ from toardb.contacts.models import Contact # the following class was taken from: # https://github.com/tiangolo/fastapi/issues/312 class Coordinates(BaseModel): - lat: float = Field(0, gte=-90, lte=90) - lng: float = Field(0, gte=-180, lte=180) - alt: float + lat: float = Field(0, gte=-90, lte=90, description="longitude coordinate of station (decimal degrees_east). This is our best estimate of the station location which is not always identical to the official station coordinates (see coordinate_validation_status).") + lng: float = Field(0, gte=-180, lte=180, description="latitude coordinate of station (decimal degrees_north). This is our best estimate of the station location which is not always identical to the official station coordinates (see coordinate_validation_status).") + alt: float = Field(0, description="altitude of station (in m above sea level). This is our best estimate of the station altitude, which is not always identical to the reported station altitude, but frequently uses the elevation from google earth instead (see coordinate_validation_status).") # ======== StationmetaCore ========= @@ -31,7 +31,7 @@ class StationmetaCoreStub(BaseModel): class StationmetaCoreBase(BaseModel): id: int = None - codes: List[str] = [] + codes: List[str] = Field(..., description="list of station's codes") name: str coordinates: Coordinates country: str @@ -370,7 +370,6 @@ class StationmetaBase(StationmetaCoreBase): aux_docs: List[StationmetaAuxDoc] = None aux_urls: List[StationmetaAuxUrl] = None globalmeta: StationmetaGlobal = None - globalservice: StationmetaGlobalService = None class Config: orm_mode = True @@ -383,7 +382,6 @@ class StationmetaCreate(StationmetaCoreCreate): aux_docs: List[StationmetaAuxDoc] = None aux_urls: List[StationmetaAuxUrl] = None globalmeta: StationmetaGlobalNestedCreate = None - globalservice: StationmetaGlobalService = None class Config: orm_mode = True