diff --git a/docs/ContactModel.rst b/docs/ContactModel.rst index d18b29bb483b39cfa4d03baea1ac727accca80d6..55894f67035658eec3b90cd06fc64b37c11b0211 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 e901a65a5535b70c5fc26859f427953ab50e8887..6a6976e61d24045ed2e99d521818789fa32cc9ee 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 7dab2cc9ac85674b5061eeb257ad4ffc0e119ae1..2a6a13ec98c5d2ca146c28ae4d85b727fca470f8 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 1c1b0d99f2d2b0084d4c50f1d0863441cd1e8875..00b2ea3a3a213a3ae2b3b43b3e072dfe4ce4016c 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 4a4b26d9f37909dec36b1c6207e20d3c1cdc9549..f00b22fb2a11086ea883741b42e34b3c1c3d9dc7 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 c70e704557b001c4d026a2fe35658f72d03eceb2..c7f23c3d01c11e7842d8db51dfb71b37bfac6ff6 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 df2b1198ec0e898a2cd7a1b5a15b527c71d121e3..d8fe29aadff6a27faedba2d34192249c2f0376f6 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 ee43e9097491edd5c947d6d1ba7b137741871d67..4be7853fcb6ca65237d9d6c61bd8783e85e43daa 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 40cb5fcbe02590bf74069515773092d5a2fe3235..49e8d15801632324faa03de7a21e7a0dff1e8d16 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 5ca163b3a38a1d3bab92478a280b2bceae291555..c42686392bb860d762857a002a8bc0e7870943e9 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 e27599605b8c335bf2d6160f2c8796e0dbe6f2b9..36b2d39ac162145cf13823697ebad32f45ece099 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 425a0887f94866032eff28fe367c0c8b06722053..9f3040c97db63811a7c7098c4d6e469aab141b0d 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 68c862971baec0add6844df1a04c0969b69190c5..7b63f479103555f5693d322e2c56134e0f41e3ab 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 f7dc21e56ced1ed65930893092d6d76a383a0369..29e6d49393ea42ba0d13ba32e1628d216df1ad37 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 058c9e60e7bfad9d18aabc118383e30a3a974598..dfc781433e9b4062527ab1c2a1332c4e579878fe 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 f71300956c45f6f6b5ea7e199871637157c4aaee..a0c304acc40045cb955c670ca879fdbce377f25c 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 824d0ac41e104eef2cc4061492e6285f7ee86283..ce84b2d961a503bd07d3dada9568d46fd0e85da0 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 65c2327fa280482359b76b2ecb03062daad468f5..eff9e460da536fee9daecab808048e81389c5266 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 38f1a2a6c2714ac8cdc83a2a1f2c6bd5342950a7..4d264d9d60bc84cf65d94a36ea07ea66fdf349bb 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)