From 8e023f5dd8d0c6e54479d45dcbc0e3aff9b96427 Mon Sep 17 00:00:00 2001 From: schroeder5 <s.schroeder@fz-juelich.de> Date: Sun, 31 May 2020 22:14:09 +0200 Subject: [PATCH] adapted sphinx documentation to new structure (ONE app); some pretty printing (fastAPI does not provide sphinx extensions like django) --- docs/ContactModel.rst | 8 +-- docs/DataModel.rst | 6 +- docs/StationmetaModel.rst | 16 ++--- docs/TimeseriesModel.rst | 14 ++-- docs/VariableModel.rst | 4 +- toardb/contacts/models_organisation.py | 33 ++++++---- toardb/contacts/models_person.py | 21 ++++-- toardb/data/models.py | 20 ++++-- toardb/stationmeta/models_annotation.py | 27 +++++--- toardb/stationmeta/models_aux.py | 69 +++++++++++++------- toardb/stationmeta/models_core.py | 48 +++++++++----- toardb/stationmeta/models_global.py | 60 +++++++++++------ toardb/stationmeta/models_global_services.py | 24 ++++--- toardb/stationmeta/models_role.py | 21 ++++-- toardb/timeseries/models_annotation.py | 27 +++++--- toardb/timeseries/models_core.py | 55 +++++++++++----- toardb/timeseries/models_programme.py | 21 ++++-- toardb/timeseries/models_role.py | 21 ++++-- toardb/variables/models.py | 27 +++++--- 19 files changed, 346 insertions(+), 176 deletions(-) diff --git a/docs/ContactModel.rst b/docs/ContactModel.rst index d18b29b..55894f6 100644 --- a/docs/ContactModel.rst +++ b/docs/ContactModel.rst @@ -1,25 +1,25 @@ Model Contact _____________ -.. automodule:: contacts.models_organisation +.. automodule:: toardb.contacts.models_organisation :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: contacts.models_person +.. automodule:: toardb.contacts.models_person :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: contacts.models_programme +.. automodule:: toardb.contacts.models_programme :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: contacts.schemas +.. automodule:: toardb.contacts.schemas :members: :undoc-members: :inherited-members: diff --git a/docs/DataModel.rst b/docs/DataModel.rst index e901a65..6a6976e 100644 --- a/docs/DataModel.rst +++ b/docs/DataModel.rst @@ -1,13 +1,15 @@ Model Data __________ -.. automodule:: data.models +.. _APIReference: + +.. automodule:: toardb.data.models :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: data.schemas +.. automodule:: toardb.data.schemas :members: :undoc-members: :inherited-members: diff --git a/docs/StationmetaModel.rst b/docs/StationmetaModel.rst index 7dab2cc..2a6a13e 100644 --- a/docs/StationmetaModel.rst +++ b/docs/StationmetaModel.rst @@ -1,49 +1,49 @@ Model Stationmeta _________________ -.. automodule:: stationmeta.models_core +.. automodule:: toardb.stationmeta.models_core :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_global_services +.. automodule:: toardb.stationmeta.models_global_services :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_global +.. automodule:: toardb.stationmeta.models_global :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_provider +.. automodule:: toardb.stationmeta.models_provider :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_aux +.. automodule:: toardb.stationmeta.models_aux :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_annotation +.. automodule:: toardb.stationmeta.models_annotation :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.models_role +.. automodule:: toardb.stationmeta.models_role :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: stationmeta.schemas +.. automodule:: toardb.stationmeta.schemas :members: :undoc-members: :inherited-members: diff --git a/docs/TimeseriesModel.rst b/docs/TimeseriesModel.rst index 1c1b0d9..00b2ea3 100644 --- a/docs/TimeseriesModel.rst +++ b/docs/TimeseriesModel.rst @@ -3,25 +3,31 @@ ________________ .. _APIReference: -.. automodule:: timeseries.models_core +.. automodule:: toardb.timeseries.models_core :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: timeseries.models_annotation +.. automodule:: toardb.timeseries.models_annotation :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: timeseries.models_role +.. automodule:: toardb.timeseries.models_role :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: timeseries.schemas +.. automodule:: toardb.timeseries.models_programme + :members: + :undoc-members: + :inherited-members: + :show-inheritance: + +.. automodule:: toardb.timeseries.schemas :members: :undoc-members: :inherited-members: diff --git a/docs/VariableModel.rst b/docs/VariableModel.rst index 4a4b26d..f00b22f 100644 --- a/docs/VariableModel.rst +++ b/docs/VariableModel.rst @@ -3,13 +3,13 @@ ______________ .. _APIReference: -.. automodule:: variable.models +.. automodule:: toardb.variables.models :members: :undoc-members: :inherited-members: :show-inheritance: -.. automodule:: variable.schemas +.. automodule:: toardb.variables.schemas :members: :undoc-members: :inherited-members: diff --git a/toardb/contacts/models_organisation.py b/toardb/contacts/models_organisation.py index c70e704..c7f23c3 100644 --- a/toardb/contacts/models_organisation.py +++ b/toardb/contacts/models_organisation.py @@ -12,17 +12,28 @@ metadata = Base.metadata class Organisation(Base): """ Table "public.organisations" - Column | Type | Collation | Nullable | Default - ----------------+------------------------+-----------+----------+------------------------------------------- - id | integer | | not null | nextval('organisations_id_seq'::regclass) - name | character varying(32) | | not null | - longname | character varying(128) | | not null | - kind | integer | | not null | - city | character varying(64) | | not null | - postcode | character varying(16) | | not null | - street_address | character varying(128) | | not null | - country | character varying(64) | | not null | - homepage | character varying(200) | | not null | + + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +================+========================+===========+==========+===========================================+ + | id | integer | | not null | nextval('organisations_id_seq'::regclass) | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | name | character varying(32) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | longname | character varying(128) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | kind | integer | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | city | character varying(64) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | postcode | character varying(16) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | street_address | character varying(128) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | country | character varying(64) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ + | homepage | character varying(200) | | not null | | + +----------------+------------------------+-----------+----------+-------------------------------------------+ Indexes: "organisations_pkey" PRIMARY KEY, btree (id) Check constraints: diff --git a/toardb/contacts/models_person.py b/toardb/contacts/models_person.py index df2b119..d8fe29a 100644 --- a/toardb/contacts/models_person.py +++ b/toardb/contacts/models_person.py @@ -11,13 +11,20 @@ metadata = Base.metadata class Person(Base): """ Table "public.persons" - Column | Type | Collation | Nullable | Default - -----------+------------------------+-----------+----------+------------------------------------- - id | integer | | not null | nextval('persons_id_seq'::regclass) - name | character varying(64) | | not null | - email | character varying(128) | | not null | - phone | character varying(32) | | not null | - isprivate | boolean | | not null | + + +-----------+------------------------+-----------+----------+-------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +===========+========================+===========+==========+=====================================+ + | id | integer | | not null | nextval('persons_id_seq'::regclass) | + +-----------+------------------------+-----------+----------+-------------------------------------+ + | name | character varying(64) | | not null | | + +-----------+------------------------+-----------+----------+-------------------------------------+ + | email | character varying(128) | | not null | | + +-----------+------------------------+-----------+----------+-------------------------------------+ + | phone | character varying(32) | | not null | | + +-----------+------------------------+-----------+----------+-------------------------------------+ + | isprivate | boolean | | not null | | + +-----------+------------------------+-----------+----------+-------------------------------------+ Indexes: "persons_pkey" PRIMARY KEY, btree (id) Referenced by: diff --git a/toardb/data/models.py b/toardb/data/models.py index ee43e90..4be7853 100644 --- a/toardb/data/models.py +++ b/toardb/data/models.py @@ -11,12 +11,19 @@ metadata = Base.metadata class Data(Base): """ Table "public.data" - Column | Type | Collation | Nullable | Default - ---------------+--------------------------+-----------+----------+--------- - datetime | timestamp with time zone | | not null | - value | double precision | | not null | - flags | integer | | not null | - timeseries_id | integer | | not null | + + +---------------+--------------------------+-----------+----------+---------+ + |Column |Type |Collation |Nullable |Default | + +===============+==========================+===========+==========+=========+ + | datetime | timestamp with time zone | | not null | | + +---------------+--------------------------+-----------+----------+---------+ + | value | double precision | | not null | | + +---------------+--------------------------+-----------+----------+---------+ + | flags | integer | | not null | | + +---------------+--------------------------+-----------+----------+---------+ + | timeseries_id | integer | | not null | | + +---------------+--------------------------+-----------+----------+---------+ + Indexes: "data_pkey" PRIMARY KEY, btree (timeseries_id, datetime) "data_datetime_idx" btree (datetime) @@ -27,6 +34,7 @@ class Data(Base): Foreign-key constraints: "data_timeseries_id_fkey" FOREIGN KEY (timeseries_id) REFERENCES timeseries(id) """ + __tablename__ = 'data' __table_args__ = ( PrimaryKeyConstraint('timeseries_id', 'datetime'), diff --git a/toardb/stationmeta/models_annotation.py b/toardb/stationmeta/models_annotation.py index 40cb5fc..49e8d15 100644 --- a/toardb/stationmeta/models_annotation.py +++ b/toardb/stationmeta/models_annotation.py @@ -15,15 +15,24 @@ metadata = Base.metadata class StationmetaAnnotation(Base): """ Table "public.stationmeta_annotations" - Column | Type | Collation | Nullable | Default - ----------------+--------------------------+-----------+----------+---------------------------------------------------- - id | integer | | not null | nextval('station_annotations_id_seq'::regclass) - kind | integer | | not null | - text | text | | not null | - date_added | timestamp with time zone | | not null | - approved | boolean | | not null | - contributor_id | integer | | not null | - station_id | integer | | not null | + + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +================+==========================+===========+==========+====================================================+ + | id | integer | | not null | nextval('station_annotations_id_seq'::regclass) | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | kind | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | text | text | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | approved | boolean | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | contributor_id | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | station_id | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ Indexes: "stationmeta_annotations_pkey" PRIMARY KEY, btree (id) "stationmeta_annotations_contributor_id_a5009820" btree (contributor_id) diff --git a/toardb/stationmeta/models_aux.py b/toardb/stationmeta/models_aux.py index 5ca163b..c426863 100644 --- a/toardb/stationmeta/models_aux.py +++ b/toardb/stationmeta/models_aux.py @@ -22,13 +22,20 @@ metadata = Base.metadata class StationmetaAuxDoc(Base): """ Table "public.stationmeta_aux_doc" - Column | Type | Collation | Nullable | Default - ----------------------+--------------------------+-----------+----------+------------------------------------------------- - id | integer | | not null | nextval('stationmeta_aux_doc_id_seq'::regclass) - resource_description | text | | not null | - date_added | timestamp with time zone | | not null | - resource | character varying(100) | | not null | - station_id | integer | | | + + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +======================+==========================+===========+==========+=================================================+ + | id | integer | | not null | nextval('stationmeta_aux_doc_id_seq'::regclass) | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | resource_description | text | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | resource | character varying(100) | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | station_id | integer | | | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ Indexes: "stationmeta_aux_doc_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_doc_station_id_17bdb5f2" btree (station_id) @@ -49,15 +56,24 @@ class StationmetaAuxDoc(Base): class StationmetaAuxImage(Base): """ Table "public.stationmeta_aux_image" - Column | Type | Collation | Nullable | Default - ----------------------+--------------------------+-----------+----------+--------------------------------------------------- - id | integer | | not null | nextval('stationmeta_aux_image_id_seq'::regclass) - resource_description | text | | not null | - date_added | timestamp with time zone | | not null | - resource | character varying(100) | | not null | - image_height | integer | | not null | - image_width | integer | | not null | - station_id | integer | | | + + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +======================+==========================+===========+==========+===================================================+ + | id | integer | | not null | nextval('stationmeta_aux_image_id_seq'::regclass) | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | resource_description | text | | not null | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | resource | character varying(100) | | not null | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | image_height | integer | | not null | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | image_width | integer | | not null | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ + | station_id | integer | | | | + +----------------------+--------------------------+-----------+----------+---------------------------------------------------+ Indexes: "stationmeta_aux_image_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_image_station_id_fbfbdb29" btree (station_id) @@ -87,13 +103,20 @@ class StationmetaAuxImage(Base): class StationmetaAuxUrl(Base): """ Table "public.stationmeta_aux_url" - Column | Type | Collation | Nullable | Default - ----------------------+--------------------------+-----------+----------+------------------------------------------------- - id | integer | | not null | nextval('stationmeta_aux_url_id_seq'::regclass) - resource_description | text | | not null | - date_added | timestamp with time zone | | not null | - resource | character varying(200) | | not null | - station_id | integer | | | + + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +======================+==========================+===========+==========+=================================================+ + | id | integer | | not null | nextval('stationmeta_aux_url_id_seq'::regclass) | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | resource_description | text | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | resource | character varying(200) | | not null | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ + | station_id | integer | | | | + +----------------------+--------------------------+-----------+----------+-------------------------------------------------+ Indexes: "stationmeta_aux_url_pkey" PRIMARY KEY, btree (id) "stationmeta_aux_url_station_id_727571bd" btree (station_id) diff --git a/toardb/stationmeta/models_core.py b/toardb/stationmeta/models_core.py index e275996..36b2d39 100644 --- a/toardb/stationmeta/models_core.py +++ b/toardb/stationmeta/models_core.py @@ -18,22 +18,38 @@ metadata = Base.metadata class StationmetaCore(Base): """ Table "public.stationmeta_core" - Column | Type | Collation | Nullable | Default - ------------------------------+--------------------------+-----------+----------+---------------------------------------------- - id | integer | | not null | nextval('stationmeta_core_id_seq'::regclass) - codes | character varying(16)[] | | | - name | character varying(128) | | not null | - coordinates | geometry(PointZ,4326) | | not null | - country | character varying(128) | | not null | - state | character varying(128) | | not null | - coordinate_validation_status | integer | | not null | - coordinate_validation_date | timestamp with time zone | | not null | - type_of_environment | integer | | not null | - type_of_area | integer | | not null | - category | character varying(128) | | not null | - timezone | character varying(64) | | not null | - additional_metadata | jsonb | | not null | - coordinate_validator_id | integer | | not null | + + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +==============================+==========================+===========+==========+==============================================+ + | id | integer | | not null | nextval('stationmeta_core_id_seq'::regclass) | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | codes | character varying(16)[] | | | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | name | character varying(128) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | coordinates | geometry(PointZ,4326) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | country | character varying(128) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | state | character varying(128) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | coordinate_validation_status | integer | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | coordinate_validation_date | timestamp with time zone | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | type_of_environment | integer | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | type_of_area | integer | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | category | character varying(128) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | timezone | character varying(64) | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | additional_metadata | jsonb | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ + | coordinate_validator_id | integer | | not null | | + +------------------------------+--------------------------+-----------+----------+----------------------------------------------+ Indexes: "stationmeta_core_pkey" PRIMARY KEY, btree (id) "stationmeta_core_coordinate_validator_id_38c0ef8d" btree (coordinate_validator_id) diff --git a/toardb/stationmeta/models_global.py b/toardb/stationmeta/models_global.py index 425a088..9f3040c 100644 --- a/toardb/stationmeta/models_global.py +++ b/toardb/stationmeta/models_global.py @@ -18,26 +18,46 @@ metadata = Base.metadata class StationmetaGlobal(Base): """ Table "public.stationmeta_global" - Column | Type | Collation | Nullable | Default - --------------------------------------+------------------+-----------+----------+------------------------------------------------ - id | integer | | not null | nextval('stationmeta_global_id_seq'::regclass) - population_density_year2010 | double precision | | not null | - max_population_density_25km_year2010 | double precision | | not null | - climatic_zone | integer | | not null | - nightlight_1km_year2013 | double precision | | not null | - nightlight_5km_year2013 | double precision | | not null | - max_nightlight_25km_year2013 | double precision | | not null | - wheat_production_year2000 | double precision | | not null | - rice_production_year2000 | double precision | | not null | - edgar_htap_v2_nox_emissions_year2010 | double precision | | not null | - omi_no2_column_years2011to2015 | double precision | | not null | - htap_region_tier1 | integer | | not null | - etopo_alt | double precision | | not null | - etopo_min_alt_5km | double precision | | not null | - etopo_relative_alt | double precision | | not null | - dominant_landcover_year2012 | integer | | not null | - toar1_category | integer | | not null | - station_id | integer | | not null | + + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +======================================+==================+===========+==========+================================================+ + | id | integer | | not null | nextval('stationmeta_global_id_seq'::regclass) | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | population_density_year2010 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | max_population_density_25km_year2010 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | climatic_zone | integer | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | nightlight_1km_year2013 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | nightlight_5km_year2013 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | max_nightlight_25km_year2013 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | wheat_production_year2000 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | rice_production_year2000 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | edgar_htap_v2_nox_emissions_year2010 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | omi_no2_column_years2011to2015 | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | htap_region_tier1 | integer | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | etopo_alt | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | etopo_min_alt_5km | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | etopo_relative_alt | double precision | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | dominant_landcover_year2012 | integer | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | toar1_category | integer | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ + | station_id | integer | | not null | | + +--------------------------------------+------------------+-----------+----------+------------------------------------------------+ Indexes: "stationmeta_global_pkey" PRIMARY KEY, btree (id) "stationmeta_global_station_id_key" UNIQUE CONSTRAINT, btree (station_id) diff --git a/toardb/stationmeta/models_global_services.py b/toardb/stationmeta/models_global_services.py index 68c8629..7b63f47 100644 --- a/toardb/stationmeta/models_global_services.py +++ b/toardb/stationmeta/models_global_services.py @@ -11,14 +11,22 @@ metadata = Base.metadata class StationmetaGlobalService(Base): """ Table "public.stationmeta_global_services" - Column | Type | Collation | Nullable | Default - --------------------+------------------------+-----------+----------+--------------------------------------------------------- - id | integer | | not null | nextval('stationmeta_global_services_id_seq'::regclass) - variable_name | character varying(64) | | not null | - result_type | integer | | not null | - result_nvalues | integer | | not null | - service_valid_year | integer | | | - service_url | character varying(200) | | not null | + + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +====================+========================+===========+==========+=========================================================+ + | id | integer | | not null | nextval('stationmeta_global_services_id_seq'::regclass) | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | variable_name | character varying(64) | | not null | | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | result_type | integer | | not null | | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | result_nvalues | integer | | not null | | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | service_valid_year | integer | | | | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ + | service_url | character varying(200) | | not null | | + +--------------------+------------------------+-----------+----------+---------------------------------------------------------+ Indexes: "stationmeta_global_services_pkey" PRIMARY KEY, btree (id) "stationmeta_global_services_service_url_key" UNIQUE CONSTRAINT, btree (service_url) diff --git a/toardb/stationmeta/models_role.py b/toardb/stationmeta/models_role.py index f7dc21e..29e6d49 100644 --- a/toardb/stationmeta/models_role.py +++ b/toardb/stationmeta/models_role.py @@ -15,13 +15,20 @@ metadata = Base.metadata class StationmetaRole(Base): """ Table "public.stationmeta_roles" - Column | Type | Collation | Nullable | Default - ------------+---------+-----------+----------+------------------------------------------- - id | integer | | not null | nextval('station_roles_id_seq'::regclass) - role | integer | | not null | - status | integer | | not null | - person_id | integer | | not null | - station_id | integer | | not null | + + +------------+---------+-----------+----------+-------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +============+=========+===========+==========+===========================================+ + | id | integer | | not null | nextval('station_roles_id_seq'::regclass) | + +------------+---------+-----------+----------+-------------------------------------------+ + | role | integer | | not null | | + +------------+---------+-----------+----------+-------------------------------------------+ + | status | integer | | not null | | + +------------+---------+-----------+----------+-------------------------------------------+ + | person_id | integer | | not null | | + +------------+---------+-----------+----------+-------------------------------------------+ + | station_id | integer | | not null | | + +------------+---------+-----------+----------+-------------------------------------------+ Indexes: "stationmeta_roles_pkey" PRIMARY KEY, btree (id) "stationmeta_roles_station_id_role_person_id_29a832af_uniq" UNIQUE CONSTRAINT, btree (station_id, role, person_id) diff --git a/toardb/timeseries/models_annotation.py b/toardb/timeseries/models_annotation.py index 058c9e6..dfc7814 100644 --- a/toardb/timeseries/models_annotation.py +++ b/toardb/timeseries/models_annotation.py @@ -15,15 +15,24 @@ metadata = Base.metadata class TimeseriesAnnotation(Base): """ Table "public.timeseries_annotations" - Column | Type | Collation | Nullable | Default - ----------------+--------------------------+-----------+----------+---------------------------------------------------- - id | integer | | not null | nextval('timeseries_annotations_id_seq'::regclass) - kind | integer | | not null | - text | text | | not null | - date_added | timestamp with time zone | | not null | - approved | boolean | | not null | - contributor_id | integer | | not null | - timeseries_id | integer | | not null | + + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +================+==========================+===========+==========+====================================================+ + | id | integer | | not null | nextval('timeseries_annotations_id_seq'::regclass) | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | kind | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | text | text | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | approved | boolean | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | contributor_id | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ + | timeseries_id | integer | | not null | | + +----------------+--------------------------+-----------+----------+----------------------------------------------------+ Indexes: "timeseries_annotations_pkey" PRIMARY KEY, btree (id) "timeseries_annotations_contributor_id_7a1758f6" btree (contributor_id) diff --git a/toardb/timeseries/models_core.py b/toardb/timeseries/models_core.py index f713009..a0c304a 100644 --- a/toardb/timeseries/models_core.py +++ b/toardb/timeseries/models_core.py @@ -1,4 +1,8 @@ # coding: utf-8 +""" +class Timeseries (Base) +======================= +""" from sqlalchemy import Column, DateTime, Float, ForeignKey, Integer, text, String, \ Text, CheckConstraint, UniqueConstraint #from sqlalchemy.orm import relationship @@ -13,23 +17,40 @@ metadata = Base.metadata class Timeseries(Base): """ Table "public.timeseries" - Column | Type | Collation | Nullable | Default - ---------------------+--------------------------+-----------+----------+---------------------------------------- - id | integer | | not null | nextval('timeseries_id_seq'::regclass) - label | character varying(128) | | not null | - order | integer | | not null | - access_rights | integer | | not null | - sampling_frequency | integer | | not null | - aggregation | integer | | not null | - data_start_date | timestamp with time zone | | not null | - data_end_date | timestamp with time zone | | not null | - measurement_method | character varying(128) | | not null | - sampling_height | double precision | | not null | - additional_metadata | jsonb | | not null | - date_added | timestamp with time zone | | not null | - date_modified | timestamp with time zone | | not null | - station_id | integer | | | - variable_id | integer | | | + + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +=====================+==========================+===========+==========+========================================+ + | id | integer | | not null | nextval('timeseries_id_seq'::regclass) | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | label | character varying(128) | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | order | integer | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | access_rights | integer | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | sampling_frequency | integer | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | aggregation | integer | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | data_start_date | timestamp with time zone | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | data_end_date | timestamp with time zone | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | measurement_method | character varying(128) | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | sampling_height | double precision | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | additional_metadata | jsonb | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | date_added | timestamp with time zone | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | date_modified | timestamp with time zone | | not null | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | station_id | integer | | | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ + | variable_id | integer | | | | + +---------------------+--------------------------+-----------+----------+----------------------------------------+ Indexes: "timeseries_pkey" PRIMARY KEY, btree (id) "timeseries_station_id_variable_id_label_055cfe3a_uniq" UNIQUE CONSTRAINT, btree (station_id, variable_id, label) diff --git a/toardb/timeseries/models_programme.py b/toardb/timeseries/models_programme.py index 824d0ac..ce84b2d 100644 --- a/toardb/timeseries/models_programme.py +++ b/toardb/timeseries/models_programme.py @@ -13,13 +13,20 @@ metadata = Base.metadata # this has at the moment no relation to anything!!! class TimeseriesProgramme(Base): """ Table "public.timeseries_programmes" - Column | Type | Collation | Nullable | Default - -------------+------------------------+-----------+----------+--------------------------------------------------- - id | integer | | not null | nextval('timeseries_programmes_id_seq'::regclass) - name | character varying(32) | | not null | - longname | character varying(128) | | not null | - homepage | character varying(200) | | not null | - description | text | | not null | + + +-------------+------------------------+-----------+----------+---------------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +=============+========================+===========+==========+===================================================+ + | id | integer | | not null | nextval('timeseries_programmes_id_seq'::regclass) | + +-------------+------------------------+-----------+----------+---------------------------------------------------+ + | name | character varying(32) | | not null | | + +-------------+------------------------+-----------+----------+---------------------------------------------------+ + | longname | character varying(128) | | not null | | + +-------------+------------------------+-----------+----------+---------------------------------------------------+ + | homepage | character varying(200) | | not null | | + +-------------+------------------------+-----------+----------+---------------------------------------------------+ + | description | text | | not null | | + +-------------+------------------------+-----------+----------+---------------------------------------------------+ Indexes: "timeseries_programmes_pkey" PRIMARY KEY, btree (id) """ diff --git a/toardb/timeseries/models_role.py b/toardb/timeseries/models_role.py index 65c2327..eff9e46 100644 --- a/toardb/timeseries/models_role.py +++ b/toardb/timeseries/models_role.py @@ -15,13 +15,20 @@ metadata = Base.metadata class TimeseriesRole(Base): """ Table "public.timeseries_roles" - Column | Type | Collation | Nullable | Default - ---------------+---------+-----------+----------+---------------------------------------------- - id | integer | | not null | nextval('timeseries_roles_id_seq'::regclass) - role | integer | | not null | - status | integer | | not null | - person_id | integer | | not null | - timeseries_id | integer | | not null | + + +---------------+---------+-----------+----------+----------------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +===============+=========+===========+==========+==============================================+ + | id | integer | | not null | nextval('timeseries_roles_id_seq'::regclass) | + +---------------+---------+-----------+----------+----------------------------------------------+ + | role | integer | | not null | | + +---------------+---------+-----------+----------+----------------------------------------------+ + | status | integer | | not null | | + +---------------+---------+-----------+----------+----------------------------------------------+ + | person_id | integer | | not null | | + +---------------+---------+-----------+----------+----------------------------------------------+ + | timeseries_id | integer | | not null | | + +---------------+---------+-----------+----------+----------------------------------------------+ Indexes: "timeseries_roles_pkey" PRIMARY KEY, btree (id) "timeseries_roles_timeseries_id_role_person_id_d888d4bf_uniq" UNIQUE CONSTRAINT, btree (timeseries_id, role, person_id) diff --git a/toardb/variables/models.py b/toardb/variables/models.py index 38f1a2a..4d264d9 100644 --- a/toardb/variables/models.py +++ b/toardb/variables/models.py @@ -11,15 +11,24 @@ metadata = Base.metadata class Variable(Base): """ Table "public.variables" - Column | Type | Collation | Nullable | Default - ------------------+------------------------+-----------+----------+--------------------------------------- - id | integer | | not null | nextval('variables_id_seq'::regclass) - name | character varying(32) | | not null | - longname | character varying(128) | | not null | - displayname | character varying(128) | | not null | - cf_standardname | character varying(128) | | not null | - units | character varying(64) | | not null | - chemical_formula | character varying(128) | | not null | + + +------------------+------------------------+-----------+----------+---------------------------------------+ + | Column | Type | Collation | Nullable | Default | + +==================+========================+===========+==========+=======================================+ + | id | integer | | not null | nextval('variables_id_seq'::regclass) | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | name | character varying(32) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | longname | character varying(128) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | displayname | character varying(128) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | cf_standardname | character varying(128) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | units | character varying(64) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ + | chemical_formula | character varying(128) | | not null | | + +------------------+------------------------+-----------+----------+---------------------------------------+ Indexes: "variables_pkey" PRIMARY KEY, btree (id) "variables_name_key" UNIQUE CONSTRAINT, btree (name) -- GitLab