Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iss #193 fix 'optional' and 'not null' conflict #201

Merged
merged 11 commits into from
Jan 26, 2023
Merged
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ types and units.

1. To `sensor` object, added:
1. `sensor_body_size_mm` (Issue [#155](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/155))
1. To `logger_main_config`:
1. fix inconsistency with data types for `logger_firmware_version`. (Issue [#87](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/87))
1. Fix inconsistency with data types for:
1. `logger_firmware_version` (Issue [#87](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/87))
1. `measurement_units_id` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `mast_geometry_id` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `classification` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `structure_type_id` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `orientation_reference` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `device_vertical_orientation` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `sensor_type_id` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `mounting_type_id` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `mast_properties`.`date_from` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `lidar_config`.`date_from` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `vertical_profiler_properties`.`date_from` (Issue [#193](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/193))
1. `height_reference` (Issue [#202](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/202))
1. To `logger_measurement_config` object:
1. added `logger_stated_boom_orientation_deg` (Issue [#190](https://github.com/IEA-Task-43/digital_wra_data_standard/issues/190))
Expand Down
66 changes: 51 additions & 15 deletions schema/iea43_wra_data_model.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@
"enum": [
"magnetic_north",
"true_north",
"grid_north"
"grid_north",
null
]
},
"height_reference": {
Expand Down Expand Up @@ -365,7 +366,8 @@
"lattice_triangle",
"lattice_square_round_edges",
"lattice_square_sharp_edges",
"pole"
"pole",
null
]
},
"mast_oem": {
Expand Down Expand Up @@ -416,7 +418,16 @@
]
},
"date_from": {
"$ref": "#/definitions/date_from"
"type": [
"string",
"null"
],
"format": "date-time",
"title": "Date From",
"description": "The date from when these properties are active. If these properties follow a change, then this Date From should equal the previous Date To. The format of this date should follow ISO 8601 with the 'T' required. If a timezone is used, it is essential that this timezone is the same as the logger timezone.",
"examples": [
"2020-07-28T20:00:00"
]
},
"date_to": {
"$ref": "#/definitions/date_to"
Expand Down Expand Up @@ -673,11 +684,21 @@
"description": "The vertical orientation that the remote sensing device is installed. E.g. an ADCP mounted on the sea floor has an 'upwards' vertical orientation pointing towards the sea surface whereas an ADCP mounted underneath a buoy has a 'downward' vertical orientation pointing towards the sea floor.",
"enum": [
"upward",
"downward"
"downward",
null
]
},
"date_from": {
"$ref": "#/definitions/date_from"
"type": [
"string",
"null"
],
"format": "date-time",
"title": "Date From",
"description": "The date from when these properties are active. If these properties follow a change, then this Date From should equal the previous Date To. The format of this date should follow ISO 8601 with the 'T' required. If a timezone is used, it is essential that this timezone is the same as the logger timezone.",
"examples": [
"2020-07-28T20:00:00"
]
},
"date_to": {
"$ref": "#/definitions/date_to"
Expand Down Expand Up @@ -935,7 +956,16 @@
]
},
"date_from": {
"$ref": "#/definitions/date_from"
"type": [
"string",
"null"
],
"format": "date-time",
"title": "Date From",
"description": "The date from when these properties are active. If these properties follow a change, then this Date From should equal the previous Date To. The format of this date should follow ISO 8601 with the 'T' required. If a timezone is used, it is essential that this timezone is the same as the logger timezone.",
"examples": [
"2020-07-28T20:00:00"
]
},
"date_to": {
"$ref": "#/definitions/date_to"
Expand Down Expand Up @@ -1032,7 +1062,10 @@
"description": "The sensitivity programmed into the logger. Usually used for pyranometers. It is the same as 1/slope with zero for offset."
},
"measurement_units_id": {
"type": "string",
"type": [
"string",
"null"
],
"title": "Measurement Units",
"description": "The measurement units of the values the sensor records.",
"enum": [
Expand Down Expand Up @@ -1075,7 +1108,8 @@
"ppt",
"psu",
"S/m",
"-"
"-",
null
]
},
"height_m": {
Expand Down Expand Up @@ -1269,11 +1303,15 @@
"ctd",
"lidar",
"sodar",
"other"
"other",
null
]
},
"classification": {
"type": "string",
"type": [
"string",
"null"
],
"title": "Classification",
"description": "The classification of a particular anemometer for this location. This combines the class index (number) with the terrain class (A, B, C, D or S) e.g. 1.2A. The format of this is validated by a regex which has the form of ^[0-9][.][0-9][ABCDS]$ i.e. digit.digit followed by a character.",
"examples": [
Expand Down Expand Up @@ -1564,7 +1602,8 @@
"enum": [
"side",
"goal_post",
"top"
"top",
null
]
},
"boom_orientation_deg": {
Expand Down Expand Up @@ -1694,10 +1733,7 @@
"title": "Interference Structures",
"properties":{
"structure_type_id":{
"type": [
"string",
"null"
],
"type": "string",
"title": "Structure Type",
"description": "The type of structure that is causing an interference in the sensor's measurements.",
"enum": [
Expand Down
8 changes: 4 additions & 4 deletions tools/iea43_wra_data_model_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ CREATE TABLE IF NOT EXISTS mast_section_geometry(

CREATE TABLE IF NOT EXISTS vertical_profiler_properties(
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
measurement_location_uuid UUID,
measurement_location_uuid UUID NOT NULL,
device_datum_plane_height_m decimal,
height_reference_id text DEFAULT 'ground_level',
device_orientation_deg decimal CHECK (device_orientation_deg >= 0 AND device_orientation_deg <= 360),
orientation_reference_id text,
device_vertical_orientation_id text,
date_from timestamp WITHOUT TIME ZONE NOT NULL,
date_from timestamp WITHOUT TIME ZONE,
date_to timestamp WITHOUT TIME ZONE,
notes text,
update_at timestamp WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
Expand Down Expand Up @@ -415,7 +415,7 @@ CREATE TABLE IF NOT EXISTS lidar_config(
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
logger_main_config_uuid UUID,
flow_corrections_applied boolean,
date_from timestamp WITHOUT TIME ZONE NOT NULL,
date_from timestamp WITHOUT TIME ZONE,
date_to timestamp WITHOUT TIME ZONE,
notes text,
update_at timestamp WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
Expand Down Expand Up @@ -444,7 +444,7 @@ CREATE TABLE IF NOT EXISTS logger_measurement_config(
slope decimal,
"offset" decimal, -- offset is a SQL reserved word so needs to be escaped
sensitivity decimal,
measurement_units_id text NOT NULL,
measurement_units_id text,
height_m decimal,
serial_number text,
connection_channel text,
Expand Down