diff --git a/docs/toardb_fastapi.md b/docs/toardb_fastapi.md index 784157b5b91444bc5822dc65baa5af288f42c230..9a3e91095e84df0739f9a8c437ff1d7563c5fe4f 100644 --- a/docs/toardb_fastapi.md +++ b/docs/toardb_fastapi.md @@ -8,7 +8,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | person | [Person](#person) | A contact is either a person or an organisation | Yes | | organisation | [Organisation](#organisation) | A contact is either a person or an organisation | Yes | @@ -34,7 +34,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | name | string | Short name (abbreviation) of organisation | Yes | | longname | string | Long name of organisation | Yes | | kind | string | Kind of organisation | Yes | @@ -48,7 +48,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | name | string | Name of person | Yes | | email | string | Email address of person | Yes | | phone | string | Phone number of person | Yes | @@ -58,7 +58,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | codes | [ string ] | list of station's codes | Yes | | name | string | Station name for use in TOAR; normally equal to data provider’s name | Yes | | coordinates | [Coordinates](#coordinates) | Best estimate of station latitude, longitude and altitude | Yes | @@ -81,7 +81,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | kind | integer | kind of annotation (see controlled vocabulary: Kind Of Annotations) | Yes | | text | string | text of annotation | Yes | | date_added | dateTime | timestamp when annotation was added | Yes | @@ -92,33 +92,33 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | -| station_id | integer | | Yes | +| id | integer | for internal use only | Yes | +| resource_description | string | Description of the resource | Yes | +| date_added | dateTime | Date of metadata record entry into TOAR database | Yes | +| resource | string | auxillary document file | Yes | +| station_id | integer | internal station_id to which this resource belongs | Yes | #### StationmetaAuxImage | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | +| id | integer | for internal use only | Yes | +| resource_description | string | Description of the resource | Yes | +| date_added | dateTime | Date of metadata record entry into TOAR database | Yes | +| resource | string | auxillary image file | Yes | | image_height | integer | | Yes | | image_width | integer | | Yes | -| station_id | integer | | Yes | +| station_id | integer | internal station_id to which this resource belongs | Yes | #### StationmetaAuxUrl | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| resource_description | string | | Yes | -| date_added | dateTime | | Yes | -| resource | string | | Yes | -| station_id | integer | | Yes | +| id | integer | for internal use only | Yes | +| resource_description | string | Description of the resource | Yes | +| date_added | dateTime | Date of metadata record entry into TOAR database | Yes | +| resource | string | URL | Yes | +| station_id | integer | internal station_id to which this resource belongs | Yes | #### StationmetaChangelog @@ -136,7 +136,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | +| id | integer | for internal use only | Yes | | codes | [ string ] | list of station's codes | Yes | | name | string | Station name for use in TOAR; normally equal to data provider’s name | Yes | | coordinates | [Coordinates](#coordinates) | Best estimate of station latitude, longitude and altitude | Yes | @@ -168,51 +168,51 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| 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 | +| population_density_year2010 | number | human population per square km for the year 2010 | Yes | +| max_population_density_25km_year2010 | number | Year 2010 maximum population density within a radius of 25 km around station location (residents km-2) | Yes | +| climatic_zone | string | Climatic zone according to IPCC, 2006. Data from European Soil Data Centre at JRC, Ispra, Italy | Yes | +| nightlight_1km_year2013 | number | Year 2013 nighttime lights brightness values at station location (original 1 km horizontal resolution). Reference: NOAA DMSP stable nighttime lights: a 0.925 km resolution dataset of non-ephemeral visible light intensity at night [Dataset] PID: http://ngdc.noaa.gov/eog/dmsp/downloadV4composites.html | Yes | +| nightlight_5km_year2013 | number | Nighttime lights brightness values for the year 2013 at 5 km resolution (original 1 km horizontal resolution) | Yes | +| max_nightlight_25km_year2013 | number | Maximum nighttime lights brightness values for the year 2013 at 25 km resolution (original 1 km horizontal resolution) | Yes | +| wheat_production_year2000 | number | Wheat production year2000. Y2000 wheat production amount at station location (units: thousand tons). Reference: [Dataset] PID: http://gaez.fao.org/Main.html | Yes | +| rice_production_year2000 | number | Y2000 rice production amount at station location (units: thousand tons). Reference: [Dataset] PID: http://gaez.fao.org/Main.html | Yes | +| edgar_htap_v2_nox_emissions_year2010 | number | EDGAR emissions inventory for nitrogen oxides (NOx) at 0.1° resolution. Reference: Janssens-Maenhout et al., 2015: [Dataset] PID: http://edgar.jrc.ec.europa.eu/htap_v2/index.php?SECURE=123 | Yes | +| omi_no2_column_years2011to2015 | number | Average Y2011-Y2015 tropospheric NO2 columns from OMI at 0.1 degree resolution in units of 10^15 molecules cm-2. Reference: Krotkov et al., 2016 [Dataset] PID: (no public download) | Yes | +| htap_region_tier1 | string | The integer denoting the “tier1” region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies | Yes | +| etopo_alt | number | Global digital elevation model from diverse global and regional datasets in 1 arc minute resolution. Reference: Amante and Eakins, 2009 [Dataset] PID: https://www.ngdc.noaa.gov/mgg/global/global.html | Yes | +| etopo_min_alt_5km | number | Minimum elevation from the ETOPO1 dataset in an area of 5 km radius around the station location. This can be used to find out if a high altitude station is located in mountaineous terrain or on a plateau (see etopo_relative_alt) | Yes | +| etopo_relative_alt | number | Station elevation above the surrounding area. Derived by subtracting the minimum altitude within a 5 km radius around the station location from the actual station altitude | Yes | +| dominant_landcover_year2012 | string | The dominant IGBP landcover classification at the station location extracted from the MODIS MCD12C1 dataset (3 arc minutes resolution of the year 2012). [Dataset] PID: https://lpdaac.usgs.gov/dataset_discovery/modis/modis_products_table/mcd12c1 | Yes | +| toar1_category | string | The station classification for the Tropsopheric Ozone Assessment Report based on the station proxy data that are stored in the TOAR database | Yes | +| station_id | integer | internal station_id to which these global data belong | Yes | #### StationmetaRole | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| role | string | | Yes | -| status | string | | Yes | -| contact_id | integer | | Yes | -| contact | [Contact](#contact) | | Yes | +| id | integer | for internal use only | Yes | +| role | string | Role of contact (see controlled vocabulary: Role Codes) | Yes | +| status | string | Status of contact (see controlled vocabulary: Role Status) | Yes | +| contact_id | integer | to be deleted | Yes | +| contact | [Contact](#contact) | Contact for this role | Yes | #### Timeseries | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | | id | integer | | Yes | -| label | string | | Yes | -| order | integer | | Yes | -| access_rights | string | | Yes | -| sampling_frequency | string | | Yes | -| aggregation | string | | 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 | | Yes | -| data_end_date | dateTime | | Yes | -| measurement_method | string | | Yes | -| sampling_height | number | | Yes | -| date_added | dateTime | | Yes | -| date_modified | dateTime | | 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) | | No | | station | [StationmetaCoreBase](#stationmetacorebase) | | Yes | | variable | [Variable](#variable) | | Yes | @@ -225,47 +225,47 @@ | 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 | +| id | integer | for internal use only | Yes | +| kind | integer | kind of annotation (see controlled vocabulary: Kind Of Annotations) | Yes | +| text | string | text of annotation | Yes | +| date_added | dateTime | timestamp when annotation was added | Yes | +| approved | boolean | Flag indicating whether the annotation of a time-series has been verified | Yes | +| contributor_id | integer | ID of contributor who added the annotation | Yes | +| timeseries_id | integer | internal timeseries_id to which this annotation belongs | Yes | #### TimeseriesChangelog | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| datetime | dateTime | | Yes | -| description | string | | Yes | -| old_value | string | | Yes | -| new_value | string | | Yes | -| timeseries_id | integer | | Yes | -| author_id | integer | | Yes | -| type_of_change | integer | | Yes | -| period_start | dateTime | | No | -| period_end | dateTime | | No | -| version | string | | No | +| datetime | dateTime | Date of change to the TOAR database | Yes | +| description | string | Description of change | Yes | +| old_value | string | value that has been changed in the TOAR database | Yes | +| new_value | string | new, changed value | Yes | +| timeseries_id | integer | internal ID of time-series to which this change belongs | Yes | +| author_id | integer | internal ID of person who submitted the change to the TOAR database | Yes | +| type_of_change | integer | Type of change (see controlled vocabulary: Type Of Change) | Yes | +| period_start | dateTime | for changes on data: start date from which changes were applied | No | +| period_end | dateTime | for changes on data: end date to which changes were applied | No | +| version | string | version that results from this change | No | #### TimeseriesProgramme | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| name | string | | Yes | -| longname | string | | Yes | -| homepage | string | | Yes | -| description | string | | Yes | +| id | integer | for internal use only | Yes | +| name | string | (Short) name of programme | Yes | +| longname | string | (Long) name of programme | Yes | +| homepage | string | Homepage (URL) of programme | Yes | +| description | string | Description of programme | Yes | #### TimeseriesRole | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| role | string | | Yes | -| status | string | | Yes | -| contact | [Contact](#contact) | | Yes | +| id | integer | for internal use only | Yes | +| role | string | Role of contact (see controlled vocabulary: Role Codes) | Yes | +| status | string | Status of contact (see controlled vocabulary: Role Status) | Yes | +| contact | [Contact](#contact) | Contact for this role | Yes | #### Variable diff --git a/toardb/contacts/schemas.py b/toardb/contacts/schemas.py index 3ca0e8a40d765dd03a7766315d95f0a7cdc0dcb0..6d839211f61d09dbecf357d1d8515879b6e4c826 100644 --- a/toardb/contacts/schemas.py +++ b/toardb/contacts/schemas.py @@ -37,7 +37,7 @@ class OrganisationCreate(OrganisationBase): class Organisation(OrganisationBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -62,7 +62,7 @@ class PersonCreate(PersonBase): class Person(PersonBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -78,7 +78,7 @@ class ContactBase(BaseModel): orm_mode = True class Contact(ContactBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True diff --git a/toardb/stationmeta/schemas.py b/toardb/stationmeta/schemas.py index 3e9b829b4bdf732c20bcdfad3748f451483217a0..31c9a7a8a77fe6382f4d1480505edba0d404c97a 100644 --- a/toardb/stationmeta/schemas.py +++ b/toardb/stationmeta/schemas.py @@ -142,7 +142,7 @@ class StationmetaCoreCreate(StationmetaCoreBase): class StationmetaCore(StationmetaCoreBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -190,7 +190,7 @@ class StationmetaAnnotationCreate(StationmetaAnnotationBase): class StationmetaAnnotation(StationmetaAnnotationBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -201,10 +201,10 @@ class StationmetaAnnotation(StationmetaAnnotationBase): class StationmetaAuxDocBase(BaseModel): id: int = None - resource_description: str - date_added: dt.datetime - resource: str - station_id: int + resource_description: str = Field(..., description="Description of the resource") + date_added: dt.datetime = Field(..., description="Date of metadata record entry into TOAR database") + resource: str = Field(..., description="auxillary document file") + station_id: int = Field(..., description="internal station_id to which this resource belongs") class StationmetaAuxDocPatch(BaseModel): @@ -219,7 +219,7 @@ class StationmetaAuxDocCreate(StationmetaAuxDocBase): class StationmetaAuxDoc(StationmetaAuxDocBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -228,12 +228,12 @@ class StationmetaAuxDoc(StationmetaAuxDocBase): class StationmetaAuxImageBase(BaseModel): id: int = None - resource_description: str - date_added: dt.datetime - resource: str + resource_description: str = Field(..., description="Description of the resource") + date_added: dt.datetime = Field(..., description="Date of metadata record entry into TOAR database") + resource: str = Field(..., description="auxillary image file") image_height: int image_width: int - station_id: int + station_id: int = Field(..., description="internal station_id to which this resource belongs") class StationmetaAuxImagePatch(BaseModel): @@ -250,7 +250,7 @@ class StationmetaAuxImageCreate(StationmetaAuxImageBase): class StationmetaAuxImage(StationmetaAuxImageBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -259,10 +259,10 @@ class StationmetaAuxImage(StationmetaAuxImageBase): class StationmetaAuxUrlBase(BaseModel): id: int = None - resource_description: str - date_added: dt.datetime - resource: str - station_id: int + resource_description: str = Field(..., description="Description of the resource") + date_added: dt.datetime = Field(..., description="Date of metadata record entry into TOAR database") + resource: str = Field(..., description="URL") + station_id: int = Field(..., description="internal station_id to which this resource belongs") class StationmetaAuxUrlPatch(BaseModel): @@ -277,7 +277,7 @@ class StationmetaAuxUrlCreate(StationmetaAuxUrlBase): class StationmetaAuxUrl(StationmetaAuxUrlBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -285,23 +285,23 @@ class StationmetaAuxUrl(StationmetaAuxUrlBase): # ======== StationmetaGlobal ========= class StationmetaGlobalBase(BaseModel): - population_density_year2010: float - max_population_density_25km_year2010: float - climatic_zone: str - nightlight_1km_year2013: float - nightlight_5km_year2013: float - max_nightlight_25km_year2013: float - wheat_production_year2000: float - rice_production_year2000: float - edgar_htap_v2_nox_emissions_year2010: float - omi_no2_column_years2011to2015: float - htap_region_tier1: str - etopo_alt: float - etopo_min_alt_5km: float - etopo_relative_alt: float - dominant_landcover_year2012: str - toar1_category: str - station_id: int + population_density_year2010: float = Field(..., description="human population per square km for the year 2010") + max_population_density_25km_year2010: float = Field(..., description="Year 2010 maximum population density within a radius of 25 km around station location (residents km-2)") + climatic_zone: str = Field(..., description="Climatic zone according to IPCC, 2006. Data from European Soil Data Centre at JRC, Ispra, Italy") + nightlight_1km_year2013: float = Field(..., description="Year 2013 nighttime lights brightness values at station location (original 1 km horizontal resolution). Reference: NOAA DMSP stable nighttime lights: a 0.925 km resolution dataset of non-ephemeral visible light intensity at night [Dataset] PID: http://ngdc.noaa.gov/eog/dmsp/downloadV4composites.html") + nightlight_5km_year2013: float = Field(..., description="Nighttime lights brightness values for the year 2013 at 5 km resolution (original 1 km horizontal resolution)") + max_nightlight_25km_year2013: float = Field(..., description="Maximum nighttime lights brightness values for the year 2013 at 25 km resolution (original 1 km horizontal resolution)") + wheat_production_year2000: float = Field(..., description="Wheat production year2000. Y2000 wheat production amount at station location (units: thousand tons). Reference: [Dataset] PID: http://gaez.fao.org/Main.html") + rice_production_year2000: float = Field(..., description="Y2000 rice production amount at station location (units: thousand tons). Reference: [Dataset] PID: http://gaez.fao.org/Main.html") + edgar_htap_v2_nox_emissions_year2010: float = Field(..., description="EDGAR emissions inventory for nitrogen oxides (NOx) at 0.1° resolution. Reference: Janssens-Maenhout et al., 2015: [Dataset] PID: http://edgar.jrc.ec.europa.eu/htap_v2/index.php?SECURE=123") + omi_no2_column_years2011to2015: float = Field(..., description="Average Y2011-Y2015 tropospheric NO2 columns from OMI at 0.1 degree resolution in units of 10^15 molecules cm-2. Reference: Krotkov et al., 2016 [Dataset] PID: (no public download)") + htap_region_tier1: str = Field(..., description="The integer denoting the “tier1” region defined in the task force on hemispheric transport of air pollution (TFHTAP) coordinated model studies") + etopo_alt: float = Field(..., description="Global digital elevation model from diverse global and regional datasets in 1 arc minute resolution. Reference: Amante and Eakins, 2009 [Dataset] PID: https://www.ngdc.noaa.gov/mgg/global/global.html") + etopo_min_alt_5km: float = Field(..., description="Minimum elevation from the ETOPO1 dataset in an area of 5 km radius around the station location. This can be used to find out if a high altitude station is located in mountaineous terrain or on a plateau (see etopo_relative_alt)") + etopo_relative_alt: float = Field(..., description="Station elevation above the surrounding area. Derived by subtracting the minimum altitude within a 5 km radius around the station location from the actual station altitude") + dominant_landcover_year2012: str = Field(..., description="The dominant IGBP landcover classification at the station location extracted from the MODIS MCD12C1 dataset (3 arc minutes resolution of the year 2012). [Dataset] PID: https://lpdaac.usgs.gov/dataset_discovery/modis/modis_products_table/mcd12c1") + toar1_category: str = Field(..., description="The station classification for the Tropsopheric Ozone Assessment Report based on the station proxy data that are stored in the TOAR database") + station_id: int = Field(..., description="internal station_id to which these global data belong") @validator('climatic_zone') def check_climatic_zone(cls, v): @@ -425,11 +425,11 @@ class StationmetaGlobalNested(StationmetaGlobalBaseNested): class StationmetaGlobalServiceBase(BaseModel): id: int = None - variable_name: str - result_type: int - result_nvalues: int - service_valid_year: int - service_url: str + variable_name: str = Field(..., description="Variable name which will be returned by the service URL") + result_type: int = Field(..., description="Result type") + result_nvalues: int = Field(..., description="Expected number of return values (1-16)") + service_valid_year: int = Field(..., description="Year for which metadata are returned from this service URL or null if undefined") + service_url: str = Field(..., description="Service URL with %LAT% and %LON% placeholders to enter station or point location in floating point degrees") class StationmetaGlobalServiceCreate(StationmetaGlobalServiceBase): @@ -437,7 +437,7 @@ class StationmetaGlobalServiceCreate(StationmetaGlobalServiceBase): class StationmetaGlobalService(StationmetaGlobalServiceBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -446,14 +446,14 @@ class StationmetaGlobalService(StationmetaGlobalServiceBase): class StationmetaRoleBase(BaseModel): id: int = None - role: str - status: str + role: str = Field(..., description="Role of contact (see controlled vocabulary: Role Codes)") + status: str = Field(..., description="Status of contact (see controlled vocabulary: Role Status)") # contact: Contact # at the moment contact_id has to be given... # ==> in the future: give unique contact_email # patching stationmeta should not result in creating new contacts! # ==> still to do: check, whether contact already exists (otherwise patching cannot be done) - contact_id: int + contact_id: int = Field(..., description="to be deleted") @validator('role') def check_role(cls, v): @@ -499,8 +499,8 @@ class StationmetaRoleCreate(StationmetaRoleBase): class StationmetaRole(StationmetaRoleBase): - id: int - contact: Contact + id: int = Field(..., description="for internal use only") + contact: Contact = Field(..., description="Contact for this role") class Config: orm_mode = True @@ -570,7 +570,7 @@ class StationmetaCreate(StationmetaCoreCreate): class Stationmeta(StationmetaBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True diff --git a/toardb/timeseries/schemas.py b/toardb/timeseries/schemas.py index 649495adef6acd34baa491999cfe99a14c856d7d..3fd30661679ea5aa47138d2912cc1d0b833428a6 100644 --- a/toardb/timeseries/schemas.py +++ b/toardb/timeseries/schemas.py @@ -111,9 +111,9 @@ class TimeseriesCore(TimeseriesCoreBase): class TimeseriesRoleBase(BaseModel): id: int = None - role: str - status: str - contact: Contact + role: str = Field(..., description="Role of contact (see controlled vocabulary: Role Codes)") + status: str = Field(..., description="Status of contact (see controlled vocabulary: Role Status)") + contact: Contact = Field(..., description="Contact for this role") @validator('role') def check_role(cls, v): @@ -157,8 +157,7 @@ class TimeseriesRoleNoCreate(TimeseriesRoleCreate): class TimeseriesRole(TimeseriesRoleBase): - id: int - contact: Contact + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -166,13 +165,13 @@ class TimeseriesRole(TimeseriesRoleBase): # ======== TimeseriesAnnotation ========= class TimeseriesAnnotationBase(BaseModel): - id: int = None - kind: int - text: str - date_added: dt.datetime - approved: bool - contributor_id: int - timeseries_id: int + id: int = Field(None, description="for internal use only") + kind: int = Field(..., description="kind of annotation (see controlled vocabulary: Kind Of Annotations)") + text: str = Field(..., description="text of annotation") + date_added: dt.datetime = Field(..., description="timestamp when annotation was added") + approved: bool = Field(..., description="Flag indicating whether the annotation of a time-series has been verified") + contributor_id: int = Field(..., description="ID of contributor who added the annotation") + timeseries_id: int = Field(..., description="internal timeseries_id to which this annotation belongs") class TimeseriesAnnotationCreate(TimeseriesAnnotationBase): @@ -180,7 +179,7 @@ class TimeseriesAnnotationCreate(TimeseriesAnnotationBase): class TimeseriesAnnotation(TimeseriesAnnotationBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -189,10 +188,10 @@ class TimeseriesAnnotation(TimeseriesAnnotationBase): class TimeseriesProgrammeBase(BaseModel): id: int = None - name: str - longname: str - homepage: str - description: str + name: str = Field(..., description="(Short) name of programme") + longname: str = Field(..., description="(Long) name of programme") + homepage: str = Field(..., description="Homepage (URL) of programme") + description: str = Field(..., description="Description of programme") class TimeseriesProgrammeCreate(TimeseriesProgrammeBase): @@ -200,7 +199,7 @@ class TimeseriesProgrammeCreate(TimeseriesProgrammeBase): class TimeseriesProgramme(TimeseriesProgrammeBase): - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -209,16 +208,19 @@ class TimeseriesProgramme(TimeseriesProgrammeBase): # ======== TimeseriesChangelog ========= class TimeseriesChangelogBase(BaseModel): - datetime: dt.datetime - description: str - old_value: str - new_value: str - timeseries_id: int - author_id: int - type_of_change: int - period_start: dt.datetime = None - period_end: dt.datetime = None - version: str = None + datetime: dt.datetime = Field(..., description="Date of change to the TOAR database") + description: str = Field(..., description="Description of change") + old_value: str = Field(..., description="value that has been changed in the TOAR database") + new_value: str = Field(..., description="new, changed value") + timeseries_id: int = Field(..., description="internal ID of time-series to which this change belongs") + author_id: int = Field(..., description="internal ID of person who submitted the change to the TOAR database") + type_of_change: int = Field(..., description="Type of change (see controlled vocabulary: Type Of Change)") + period_start: dt.datetime = Field(None, description="for changes on data: start date from which changes were applied") + period_end: dt.datetime = Field(None, description="for changes on data: end date to which changes were applied") + #####to do!!!!#### + ### data version string has to be required!!! ### + ### does changes to metadata also result in a new version?! (we only have data versions!) + version: str = Field(None, description="version that results from this change") class TimeseriesChangelog(TimeseriesChangelogBase): @@ -231,18 +233,6 @@ class TimeseriesChangelog(TimeseriesChangelogBase): # ======== for nested view/upload ========= class TimeseriesBase(TimeseriesCoreBase): - label: str - order: int - access_rights: str - sampling_frequency: str - aggregation: str - source: str - data_start_date: dt.datetime - data_end_date: dt.datetime - measurement_method: str - sampling_height: float - date_added: dt.datetime - date_modified: dt.datetime station: StationmetaCoreBase variable: Variable programme: TimeseriesProgramme