Skip to content

Commit

Permalink
Rename codelists (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Feb 15, 2024
2 parents 8a69eb1 + a4b892b commit 64b3fcd
Show file tree
Hide file tree
Showing 64 changed files with 3,220 additions and 394 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Replaced label for layer description quality.
- Reduced number of seeded boreholes for development from 10'000 to 3'000.
- Use reusable card components for hydrogeology.
- Renamed various codelists to have more evocative names (e.g. `location_precision` instead of `qt_location`, `plasticity` instead of `mlpr101`, …)

### Fixed

Expand Down
18 changes: 9 additions & 9 deletions src/api-legacy/v1/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ def filterProfileLayers(self, filter={}):
cohesion_id_cli = %s
""" % self.getIdx())

if 'qt_description' in keys and filter['qt_description'] not in ['', None]:
params.append(filter['qt_description'])
if 'description_quality' in keys and filter['description_quality'] not in ['', None]:
params.append(filter['description_quality'])
where.append("""
qt_description_id_cli = %s
""" % self.getIdx())
Expand Down Expand Up @@ -649,11 +649,11 @@ def filterBorehole(self, filter={}):
drilling_diameter_bho <= %s
""" % self.getIdx())

if 'qt_location' in keys and filter[
'qt_location'] not in ['', None]:
params.append(int(filter['qt_location']))
if 'location_precision' in keys and filter[
'location_precision'] not in ['', None]:
params.append(int(filter['location_precision']))
where.append("""
qt_location_id_cli = %s
location_precision_id_cli = %s
""" % self.getIdx())

if 'reference_elevation_from' in keys and filter['reference_elevation_from'] not in ['', None]:
Expand Down Expand Up @@ -694,9 +694,9 @@ def filterBorehole(self, filter={}):
elevation_z_bho <= %s
""" % self.getIdx())

if 'qt_elevation' in keys and filter[
'qt_elevation'] not in ['', None]:
params.append(int(filter['qt_elevation']))
if 'elevation_precision' in keys and filter[
'elevation_precision'] not in ['', None]:
params.append(int(filter['elevation_precision']))
where.append("""
qt_elevation_id_cli = %s
""" % self.getIdx())
Expand Down
4 changes: 2 additions & 2 deletions src/api-legacy/v1/borehole/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def get_sql(sql_lock='', file_permission=''):
location_x_lv03_bho as location_x_lv03,
location_y_lv03_bho as location_y_lv03,
srs_id_cli as srs,
qt_location_id_cli as qt_location,
qt_location_id_cli as location_precision,
elevation_z_bho as elevation_z,
hrs_id_cli as hrs,
qt_elevation_id_cli as qt_elevation,
qt_elevation_id_cli as elevation_precision,
reference_elevation_bho as reference_elevation,
qt_reference_elevation_id_cli as qt_reference_elevation,
Expand Down
8 changes: 4 additions & 4 deletions src/api-legacy/v1/borehole/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_sql_text(language='en', cols=None):
COALESCE(
qtloc.text_cli_{language},
qtloc.text_cli_{fallback}
) as qt_location,
) as location_precision,
elevation_z_bho as elevation_z,
COALESCE(
hrs.text_cli_{language},
Expand All @@ -54,7 +54,7 @@ def get_sql_text(language='en', cols=None):
COALESCE(
qth.text_cli_{language},
qth.text_cli_{fallback}
) as qt_elevation,
) as elevation_precision,
reference_elevation_bho as reference_elevation,
COALESCE(
Expand Down Expand Up @@ -230,10 +230,10 @@ def get_sql_geolcode(cols=None, join=None, where=None):
location_y_lv03_bho as location_y_lv03,
srd.geolcode as srs,
qtloc.geolcode as qt_location,
qtloc.geolcode as location_precision,
elevation_z_bho as elevation_z,
hrs.geolcode as hrs,
qth.geolcode as qt_elevation,
qth.geolcode as elevation_precision,
reference_elevation_bho as reference_elevation,
qre.geolcode as qt_reference_elevation,
Expand Down
12 changes: 6 additions & 6 deletions src/api-legacy/v1/borehole/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def get_column(field):
elif field == 'srs':
column = 'srs_id_cli'

elif field == 'qt_location':
elif field == 'location_precision':
column = 'qt_location_id_cli'

elif field == 'qt_elevation':
elif field == 'elevation_precision':
column = 'qt_elevation_id_cli'

elif field == 'reference_elevation':
Expand Down Expand Up @@ -273,8 +273,8 @@ async def execute(self, id, field, value, user):
'restriction',
'kind',
'srs',
'qt_location',
'qt_elevation',
'location_precision',
'elevation_precision',
'hrs',
'custom.landuse',
'extended.drilling_method',
Expand Down Expand Up @@ -307,10 +307,10 @@ async def execute(self, id, field, value, user):
schema = 'custom.qt_top_bedrock'

elif field == 'qt_reference_elevation':
schema = 'qt_elevation'
schema = 'elevation_precision'

elif field == 'reference_elevation_type':
schema = 'ibor117'
schema = 'reference_elevation_type'

elif field == 'qt_total_depth_tvd':
schema = 'custom.qt_top_bedrock'
Expand Down
38 changes: 19 additions & 19 deletions src/api-legacy/v1/borehole/profile/layer/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ class GetGeologyLayer(Action):
depth_from_lay AS depth_from,
depth_to_lay AS depth_to,
last_lay AS last,
layer.qt_description_id_cli AS qt_description,
layer.qt_description_id_cli AS description_quality,
layer.lithology_id_cli AS lithology,
layer.lithostratigraphy_id_cli AS lithostratigraphy,
COALESCE(
mlpr112, '{}'::int[]
colour, '{}'::int[]
) AS color,
layer.plasticity_id_cli AS plasticity,
layer.humidity_id_cli AS humidity,
Expand All @@ -183,22 +183,22 @@ class GetGeologyLayer(Action):
mlpr113, '{}'::int[]
) AS jointing,*/
COALESCE(
mlpr108, '{}'::int[]
organic_components, '{}'::int[]
) AS organic_component,
striae_lay AS striae,
layer.grain_size_1_id_cli AS grain_size_1,
layer.grain_size_2_id_cli AS grain_size_2,
COALESCE(
mlpr110, '{}'::int[]
grain_shape, '{}'::int[]
) AS grain_shape,
COALESCE(
mlpr115, '{}'::int[]
grain_angularity, '{}'::int[]
) AS grain_granularity,
layer.cohesion_id_cli AS cohesion,
layer.uscs_1_id_cli AS uscs_1,
layer.uscs_2_id_cli AS uscs_2,
COALESCE(
mcla101, '{}'::int[]
uscs_type, '{}'::int[]
) AS uscs_3,
COALESCE(
uscs_original_lay, ''
Expand All @@ -208,7 +208,7 @@ class GetGeologyLayer(Action):
) AS original_lithology,
uscs_determination_id_cli AS uscs_determination,
COALESCE(
mcla107, '{}'::int[]
debris, '{}'::int[]
) AS debris,
layer.lithology_top_bedrock_id_cli AS lithology_top_bedrock,
COALESCE(
Expand Down Expand Up @@ -270,11 +270,11 @@ class GetGeologyLayer(Action):
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr112
id_lay_fk, array_agg(id_cli_fk) as colour
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr112'
code_cli = 'colour'
GROUP BY id_lay_fk
) clr
ON clr.id_lay_fk = id_lay
Expand All @@ -292,55 +292,55 @@ class GetGeologyLayer(Action):
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr108
id_lay_fk, array_agg(id_cli_fk) as organic_components
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr108'
code_cli = 'organic_components'
GROUP BY id_lay_fk
) oco
ON oco.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr110
id_lay_fk, array_agg(id_cli_fk) as grain_shape
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr110'
code_cli = 'grain_shape'
GROUP BY id_lay_fk
) gsh
ON gsh.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mcla101
id_lay_fk, array_agg(id_cli_fk) as uscs_type
FROM
bdms.layer_codelist
WHERE
code_cli = 'mcla101'
code_cli = 'uscs_type'
GROUP BY id_lay_fk
) us3
ON us3.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr115
id_lay_fk, array_agg(id_cli_fk) as grain_angularity
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr115'
code_cli = 'grain_angularity'
GROUP BY id_lay_fk
) ggr
ON ggr.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mcla107
id_lay_fk, array_agg(id_cli_fk) as debris
FROM
bdms.layer_codelist
WHERE
code_cli = 'mcla107'
code_cli = 'debris'
GROUP BY id_lay_fk
) dbr
ON dbr.id_lay_fk = id_lay
Expand Down
38 changes: 19 additions & 19 deletions src/api-legacy/v1/borehole/stratigraphy/layer/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class GetLayer(Action):
depth_from_lay AS depth_from,
depth_to_lay AS depth_to,
last_lay AS last,
layer.qt_description_id_cli AS qt_description,
layer.qt_description_id_cli AS description_quality,
layer.lithology_id_cli AS lithology,
layer.lithostratigraphy_id_cli AS lithostratigraphy,
COALESCE(
mlpr112, '{}'::int[]
colour, '{}'::int[]
) AS color,
layer.plasticity_id_cli AS plasticity,
layer.humidity_id_cli AS humidity,
Expand All @@ -48,22 +48,22 @@ class GetLayer(Action):
layer.alteration_id_cli AS alteration,
layer.compactness_id_cli AS compactness,
COALESCE(
mlpr108, '{}'::int[]
organic_components, '{}'::int[]
) AS organic_component,
striae_lay AS striae,
layer.grain_size_1_id_cli AS grain_size_1,
layer.grain_size_2_id_cli AS grain_size_2,
COALESCE(
mlpr110, '{}'::int[]
grain_shape, '{}'::int[]
) AS grain_shape,
COALESCE(
mlpr115, '{}'::int[]
grain_angularity, '{}'::int[]
) AS grain_granularity,
layer.cohesion_id_cli AS cohesion,
layer.uscs_1_id_cli AS uscs_1,
layer.uscs_2_id_cli AS uscs_2,
COALESCE(
mcla101, '{}'::int[]
uscs_type, '{}'::int[]
) AS uscs_3,
layer.lithology_top_bedrock_id_cli AS lithology_top_bedrock,
COALESCE(
Expand All @@ -74,7 +74,7 @@ class GetLayer(Action):
) AS original_lithology,
uscs_determination_id_cli AS uscs_determination,
COALESCE(
mcla107, '{}'::int[]
debris, '{}'::int[]
) AS debris,
COALESCE(
notes_lay, ''
Expand Down Expand Up @@ -135,11 +135,11 @@ class GetLayer(Action):
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr112
id_lay_fk, array_agg(id_cli_fk) as colour
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr112'
code_cli = 'colour'
GROUP BY id_lay_fk
) clr
ON clr.id_lay_fk = id_lay
Expand All @@ -157,55 +157,55 @@ class GetLayer(Action):
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr108
id_lay_fk, array_agg(id_cli_fk) as organic_components
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr108'
code_cli = 'organic_components'
GROUP BY id_lay_fk
) oco
ON oco.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr110
id_lay_fk, array_agg(id_cli_fk) as grain_shape
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr110'
code_cli = 'grain_shape'
GROUP BY id_lay_fk
) us3
ON us3.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mcla101
id_lay_fk, array_agg(id_cli_fk) as uscs_type
FROM
bdms.layer_codelist
WHERE
code_cli = 'mcla101'
code_cli = 'uscs_type'
GROUP BY id_lay_fk
) gsh
ON gsh.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mlpr115
id_lay_fk, array_agg(id_cli_fk) as grain_angularity
FROM
bdms.layer_codelist
WHERE
code_cli = 'mlpr115'
code_cli = 'grain_angularity'
GROUP BY id_lay_fk
) ggr
ON ggr.id_lay_fk = id_lay
LEFT JOIN (
SELECT
id_lay_fk, array_agg(id_cli_fk) as mcla107
id_lay_fk, array_agg(id_cli_fk) as debris
FROM
bdms.layer_codelist
WHERE
code_cli = 'mcla107'
code_cli = 'debris'
GROUP BY id_lay_fk
) dbr
ON dbr.id_lay_fk = id_lay
Expand Down
Loading

0 comments on commit 64b3fcd

Please sign in to comment.