diff --git a/docs/toardb_fastapi.md b/docs/toardb_fastapi.md index c8c36ada9c3901d88b2494437e3bd6c4b184f8ce..5a3cb742959e1b37fecbce2573c65ebbbfc023b6 100644 --- a/docs/toardb_fastapi.md +++ b/docs/toardb_fastapi.md @@ -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,62 +81,62 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | Yes | -| kind | integer | | Yes | -| text | string | | Yes | -| date_added | dateTime | | Yes | -| approved | boolean | | Yes | -| contributor_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 station has been verified | Yes | +| contributor_id | integer | ID of contributor who added the annotation | Yes | #### StationmetaAuxDoc | 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 | -| image_height | integer | | Yes | -| image_width | integer | | 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 image file | Yes | +| image_height | integer | Number of image pixels in direction of height | Yes | +| image_width | integer | Number of image pixels in direction of width | 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 | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| datetime | dateTime | | Yes | -| description | string | | Yes | -| old_value | string | | Yes | -| new_value | string | | Yes | -| station_id | integer | | Yes | -| author_id | integer | | Yes | -| type_of_change | integer | | Yes | +| 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 | +| station_id | integer | internal ID of station 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 | #### StationmetaCore | 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 | @@ -152,7 +152,7 @@ | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | -| id | integer | | No | +| id | integer | for internal use only | No | | 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,33 +168,33 @@ | 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: 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: http://gaez.fao.org/Main.html) | Yes | +| rice_production_year2000 | number | Y2000 rice production amount at station location (units: thousand tons) (Reference: Dataset: 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: 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: (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: 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: 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 diff --git a/toardb/stationmeta/schemas.py b/toardb/stationmeta/schemas.py index c49fd903e99b96a70c34f4c14863a774510988f1..34cfbb19b84dfb67ee825684441f726fe7128469 100644 --- a/toardb/stationmeta/schemas.py +++ b/toardb/stationmeta/schemas.py @@ -25,8 +25,7 @@ class Coordinates(BaseModel): # ======== StationmetaCore ========= class StationmetaCoreBase(BaseModel): -# id: int = Field(None, description="for internal use only") - id: int = None + id: int = Field(None, description="for internal use only") codes: List[str] = Field(..., description="list of station's codes") name: str = Field(..., description="Station name for use in TOAR; normally equal to data provider’s name") coordinates: Coordinates = Field(..., description="Best estimate of station latitude, longitude and altitude") @@ -143,8 +142,7 @@ class StationmetaCoreCreate(StationmetaCoreBase): class StationmetaCore(StationmetaCoreBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -164,16 +162,11 @@ def get_coordinates_from_geom(geom: WKTElement) -> Coordinates: class StationmetaAnnotationBase(BaseModel): id: int = None -# 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 station has been verified") -# contributor_id: int = Field(..., description="ID of contributor who added the annotation") - kind: int - text: str - date_added: dt.datetime - approved: bool - contributor_id: int + 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 station has been verified") + contributor_id: int = Field(..., description="ID of contributor who added the annotation") @validator('kind') def check_kind(cls, v): @@ -197,8 +190,7 @@ class StationmetaAnnotationCreate(StationmetaAnnotationBase): class StationmetaAnnotation(StationmetaAnnotationBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -209,14 +201,10 @@ class StationmetaAnnotation(StationmetaAnnotationBase): class StationmetaAuxDocBase(BaseModel): id: int = None -# 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") - 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): @@ -231,8 +219,7 @@ class StationmetaAuxDocCreate(StationmetaAuxDocBase): class StationmetaAuxDoc(StationmetaAuxDocBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -241,18 +228,12 @@ class StationmetaAuxDoc(StationmetaAuxDocBase): class StationmetaAuxImageBase(BaseModel): id: int = None -# 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 = Field(..., description="Number of image pixels in direction of height") -# image_width: int = Field(..., description="Number of image pixels in direction of width") -# station_id: int = Field(..., description="internal station_id to which this resource belongs") - resource_description: str - date_added: dt.datetime - resource: str - image_height: int - image_width: int - 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 image file") + image_height: int = Field(..., description="Number of image pixels in direction of height") + image_width: int = Field(..., description="Number of image pixels in direction of width") + station_id: int = Field(..., description="internal station_id to which this resource belongs") class StationmetaAuxImagePatch(BaseModel): @@ -269,8 +250,7 @@ class StationmetaAuxImageCreate(StationmetaAuxImageBase): class StationmetaAuxImage(StationmetaAuxImageBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -279,14 +259,10 @@ class StationmetaAuxImage(StationmetaAuxImageBase): class StationmetaAuxUrlBase(BaseModel): id: int = None -# 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") - 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): @@ -301,8 +277,7 @@ class StationmetaAuxUrlCreate(StationmetaAuxUrlBase): class StationmetaAuxUrl(StationmetaAuxUrlBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -310,40 +285,23 @@ class StationmetaAuxUrl(StationmetaAuxUrlBase): # ======== StationmetaGlobal ========= class StationmetaGlobalBase(BaseModel): -# 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: 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: http://gaez.fao.org/Main.html)") -# rice_production_year2000: float = Field(..., description="Y2000 rice production amount at station location (units: thousand tons) (Reference: Dataset: 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: 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: (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: 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: 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") - 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: 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: http://gaez.fao.org/Main.html)") + rice_production_year2000: float = Field(..., description="Y2000 rice production amount at station location (units: thousand tons) (Reference: Dataset: 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: 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: (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: 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: 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): @@ -466,18 +424,12 @@ class StationmetaGlobalNested(StationmetaGlobalBaseNested): # ======== StationmetaGlobalService ========= class StationmetaGlobalServiceBase(BaseModel): -# id: int = None -# 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") 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): @@ -485,8 +437,7 @@ class StationmetaGlobalServiceCreate(StationmetaGlobalServiceBase): class StationmetaGlobalService(StationmetaGlobalServiceBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True @@ -495,17 +446,14 @@ class StationmetaGlobalService(StationmetaGlobalServiceBase): class StationmetaRoleBase(BaseModel): id: int = None -# role: str = Field(..., description="Role of contact (see controlled vocabulary: Role Codes)") -# status: str = Field(..., description="Status of contact (see controlled vocabulary: Role Status)") - 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 = Field(..., description="to be deleted") - contact_id: int + contact_id: int = Field(..., description="to be deleted") @validator('role') def check_role(cls, v): @@ -551,10 +499,8 @@ class StationmetaRoleCreate(StationmetaRoleBase): class StationmetaRole(StationmetaRoleBase): -# id: int = Field(..., description="for internal use only") -# contact: Contact = Field(..., description="Contact for this role") - 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 @@ -563,20 +509,13 @@ class StationmetaRole(StationmetaRoleBase): # ======== StationmetaChangelog ========= class StationmetaChangelogBase(BaseModel): -# 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") -# station_id: int = Field(..., description="internal ID of station 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)") - datetime: dt.datetime - description: str - old_value: str - new_value: str - station_id: int - author_id: int - type_of_change: int + 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") + station_id: int = Field(..., description="internal ID of station 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)") @validator('type_of_change') @@ -632,8 +571,7 @@ class StationmetaCreate(StationmetaCoreCreate): class Stationmeta(StationmetaBase): -# id: int = Field(..., description="for internal use only") - id: int + id: int = Field(..., description="for internal use only") class Config: orm_mode = True