From 00a43d10ab63bbd6753184e888ea7d17ee4c1f1b Mon Sep 17 00:00:00 2001 From: luna <5862lunamoon@gmail.com> Date: Wed, 6 Nov 2024 15:44:11 -0800 Subject: [PATCH 1/6] private field for aquifer params --- backend/wells/models.py | 5 +++++ backend/wells/serializers.py | 3 +++ frontend/src/common/constants.js | 1 + .../SubmissionForm/AquiferParameters.vue | 4 ++++ frontend/src/wells/views/WellDetail.vue | 19 +++++++++++++++++-- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/backend/wells/models.py b/backend/wells/models.py index 12770ce37..6d66b4b0e 100644 --- a/backend/wells/models.py +++ b/backend/wells/models.py @@ -2533,6 +2533,10 @@ class AquiferParameters(AuditModel): db_comment='Valid codes for the boundaries observed in ' 'pumping test analysis. i.e. CH, NF.') + private = models.BooleanField( + default=False, choices=((False, 'No'), (True, 'Yes')) + ) + storativity = models.DecimalField( max_digits=8, decimal_places=7, blank=True, null=True, verbose_name='Storativity') @@ -2574,6 +2578,7 @@ class Meta: "pumping_test_description_code":"Identification of the testing method (e.g.basic pumping test, pumping test with monitoring wells, single-well-response/slug test, constant head).", "test_duration":"The duration of the hydraulic testing period. For consistency, do not include the recovery period.", "boundary_effect_code":"Valid codes for the boundaries observed in pumping test analysis. i.e. CH, NF.", + "private":"If a hydrogeological consultant has not provided permission with a signed data sharing agreement to share their interpretations publicly.", "storativity":"Storativity estimated from hydraulic testing (dimensionless).", "transmissivity":"Transmissivity estimated from hydraulic testing.", "hydraulic_conductivity":"Hydraulic conductivity estimated from hydraulic testing in metres per second.", diff --git a/backend/wells/serializers.py b/backend/wells/serializers.py index 2d5ded322..b0e1875d9 100644 --- a/backend/wells/serializers.py +++ b/backend/wells/serializers.py @@ -196,6 +196,7 @@ class Meta: 'pumping_test_description', 'test_duration', 'boundary_effect', + 'private', 'storativity', 'transmissivity', 'hydraulic_conductivity', @@ -217,6 +218,7 @@ class Meta: 'pumping_test_description', 'test_duration', 'boundary_effect', + 'private', 'storativity', 'transmissivity', 'hydraulic_conductivity', @@ -236,6 +238,7 @@ class Meta: 'pumping_test_description', 'test_duration', 'boundary_effect', + 'private', 'storativity', 'transmissivity', 'hydraulic_conductivity', diff --git a/frontend/src/common/constants.js b/frontend/src/common/constants.js index 7f5cdb17b..b009f8907 100644 --- a/frontend/src/common/constants.js +++ b/frontend/src/common/constants.js @@ -51,6 +51,7 @@ export const TOOLTIP_TEXT = { pumping_test_information: { pumping_test: 'Describes the type of test (step, recovery, constant rate pumping test) and type of well (pumping well, observation well).', boundary_effect: 'Describe the specific conditions that are to be imposed at the boundaries of a groundwater flow region such as a recharge (river, lake) boundary or a barrier (impermeable rock) boundary where the assumption that the aquifer is of infinite extent is no longer valid.', + private: 'Information is private if a hydrogeological consultant has not provided permission (a signed data sharing agreement) to share their interpretations publicly.', storativity: 'Storativity (S) is a dimensionless measure of the volume of water that will be discharged from an aquifer per unit area of the aquifer and per unit reduction in hydraulic head.', transmissivity: 'Describes the ability of the aquifer to transmit groundwater throughout its entire saturated thickness, is measured as the rate at which groundwater can flow through an aquifer section of unit width under a unit hydraulic gradient.', hydraulic_conductivity: 'A measure of how easily water can pass through soil or rock.', diff --git a/frontend/src/submissions/components/SubmissionForm/AquiferParameters.vue b/frontend/src/submissions/components/SubmissionForm/AquiferParameters.vue index 21475fe02..952d73b75 100644 --- a/frontend/src/submissions/components/SubmissionForm/AquiferParameters.vue +++ b/frontend/src/submissions/components/SubmissionForm/AquiferParameters.vue @@ -36,6 +36,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); Test Description Test Duration (min) Boundary Effect + This Information is Private @@ -84,6 +85,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); :errors="errors['boundary_effect']" :loaded="fieldsLoaded['boundary_effect']"/> + + + Analysis Method diff --git a/frontend/src/wells/views/WellDetail.vue b/frontend/src/wells/views/WellDetail.vue index 000ec9bc8..73acaf421 100644 --- a/frontend/src/wells/views/WellDetail.vue +++ b/frontend/src/wells/views/WellDetail.vue @@ -484,12 +484,13 @@ Licensed under the Apache License, Version 2.0 (the "License"); striped small bordered - :items="well.aquifer_parameters_set" + :items="filterAquiferParameters()" :fields="[ { key: 'start_date_pumping_test', label: 'Start Date' }, { key: 'pumping_test_description', label: 'Description' }, { key: 'test_duration', label: 'Test Duration (min)' }, { key: 'boundary_effect', label: 'Boundary Effect' }, + { key: 'private', label: 'Private' }, { key: 'storativity', label: 'Storativity' }, { key: 'transmissivity', label: 'Transmissivity (m²/day)' }, { key: 'hydraulic_conductivity', label: 'Hydraulic Conductivity (m/day)' }, @@ -509,6 +510,11 @@ Licensed under the Apache License, Version 2.0 (the "License"); + + @@ -673,7 +680,15 @@ export default { isUnpublished () { return !this.well.is_published }, - ...mapGetters(['userRoles', 'config', 'well', 'wellLicence', 'storedWellId', 'codes']) + ...mapGetters(['userRoles', 'config', 'well', 'wellLicence', 'storedWellId', 'codes']), + filterAquiferParameters () { + if (this.userRoles.wells.edit) { + return well.aquifer_parameters_set + // :items="well.aquifer_parameters_set" + } else { + return this.well.aquifer_parameters_set.filter(param => !param.private); + } + } }, methods: { handlePrint () { From f64ad75e4b14277c9c7c5ff7e70e23733beeca70 Mon Sep 17 00:00:00 2001 From: luna <5862lunamoon@gmail.com> Date: Fri, 8 Nov 2024 16:25:51 -0800 Subject: [PATCH 2/6] fix to backend and migrations and function filter) --- .../migrations/0150_auto_20241108_2357.py | 123 ++++++++++++++++++ docker-compose.yml | 2 +- frontend/src/wells/views/WellDetail.vue | 12 +- 3 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 backend/wells/migrations/0150_auto_20241108_2357.py diff --git a/backend/wells/migrations/0150_auto_20241108_2357.py b/backend/wells/migrations/0150_auto_20241108_2357.py new file mode 100644 index 000000000..0c38f9dfd --- /dev/null +++ b/backend/wells/migrations/0150_auto_20241108_2357.py @@ -0,0 +1,123 @@ +# Generated by Django 3.2.4 on 2024-11-08 23:57 + +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0001_initial'), + ('wells', '0149_add_well_status_to_view'), + ] + + operations = [ + migrations.CreateModel( + name='WellLicence', + fields=[ + ('id', models.IntegerField(primary_key=True, serialize=False)), + ('well_id', models.IntegerField()), + ('waterrightslicence_id', models.IntegerField()), + ], + options={ + 'db_table': 'well_licences', + 'managed': False, + }, + ), + migrations.AddField( + model_name='aquiferparameters', + name='private', + field=models.BooleanField(choices=[(False, 'No'), (True, 'Yes')], default=False), + ), + migrations.AlterField( + model_name='activitysubmission', + name='artesian_conditions', + field=models.BooleanField(null=True, verbose_name='Artesian Conditions'), + ), + migrations.AlterField( + model_name='activitysubmission', + name='artesian_pressure', + field=models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='Artesian Pressure'), + ), + migrations.AlterField( + model_name='activitysubmission', + name='artesian_pressure_head', + field=models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='Artesian Pressure head'), + ), + migrations.AlterField( + model_name='activitysubmission', + name='well_activity_type', + field=models.ForeignKey(db_column='well_activity_code', null=True, on_delete=django.db.models.deletion.PROTECT, to='submissions.wellactivitycode', verbose_name='Type of Work'), + ), + migrations.AlterField( + model_name='activitysubmission', + name='well_orientation', + field=models.BooleanField(choices=[(True, 'vertical'), (False, 'horizontal')], null=True, verbose_name='Orientation of Well'), + ), + migrations.AlterField( + model_name='activitysubmission', + name='well_publication_status', + field=models.ForeignKey(db_column='well_publication_status_code', default='Published', null=True, on_delete=django.db.models.deletion.PROTECT, to='wells.wellpublicationstatuscode', verbose_name='Well Publication Status'), + ), + migrations.AlterField( + model_name='aquiferparameters', + name='analysis_method', + field=models.ForeignKey(blank=True, db_column='analysis_method_code', null=True, on_delete=django.db.models.deletion.PROTECT, to='wells.analysismethodcode', verbose_name='Analysis Method'), + ), + migrations.AlterField( + model_name='aquiferparameters', + name='aquifer_parameters_guid', + field=models.UUIDField(default=uuid.uuid4, editable=False), + ), + migrations.AlterField( + model_name='aquiferparameters', + name='pumping_test_description', + field=models.ForeignKey(blank=True, db_column='pumping_test_description_code', null=True, on_delete=django.db.models.deletion.PROTECT, to='wells.pumpingtestdescriptioncode', verbose_name='Testing Type'), + ), + migrations.AlterField( + model_name='fieldsprovided', + name='alternative_specs_submitted', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='fieldsprovided', + name='hydro_fracturing_performed', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='well', + name='artesian_conditions', + field=models.BooleanField(default=False, verbose_name='Artesian Conditions'), + ), + migrations.AlterField( + model_name='well', + name='artesian_pressure_head', + field=models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='Artesian Pressure head'), + ), + migrations.AlterField( + model_name='well', + name='cross_referenced_by', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Internal team member who cross referenced well.'), + ), + migrations.AlterField( + model_name='well', + name='cross_referenced_date', + field=models.DateTimeField(null=True, verbose_name='Cross Referenced Date'), + ), + migrations.AlterField( + model_name='well', + name='distance_to_pid', + field=models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Distance to PID'), + ), + migrations.AlterField( + model_name='well', + name='geocode_distance', + field=models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Geocode Distance'), + ), + migrations.AlterField( + model_name='well', + name='natural_resource_region', + field=models.CharField(blank=True, max_length=250, null=True, verbose_name='Natural Resource Region'), + ), + ] diff --git a/docker-compose.yml b/docker-compose.yml index 74a7da7a3..e1a27d82e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -159,7 +159,7 @@ services: ############################################################################################# backend: platform: linux/x86_64 - working_dir: /app + working_dir: /backend build: context: ./backend dockerfile: Dockerfile diff --git a/frontend/src/wells/views/WellDetail.vue b/frontend/src/wells/views/WellDetail.vue index 73acaf421..ea6ec4589 100644 --- a/frontend/src/wells/views/WellDetail.vue +++ b/frontend/src/wells/views/WellDetail.vue @@ -484,7 +484,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); striped small bordered - :items="filterAquiferParameters()" + :items="this.userRoles.wells.edit ? well.aquifer_parameters_set : this.well.aquifer_parameters_set.filter(param => !param.private)" :fields="[ { key: 'start_date_pumping_test', label: 'Start Date' }, { key: 'pumping_test_description', label: 'Description' }, @@ -680,15 +680,7 @@ export default { isUnpublished () { return !this.well.is_published }, - ...mapGetters(['userRoles', 'config', 'well', 'wellLicence', 'storedWellId', 'codes']), - filterAquiferParameters () { - if (this.userRoles.wells.edit) { - return well.aquifer_parameters_set - // :items="well.aquifer_parameters_set" - } else { - return this.well.aquifer_parameters_set.filter(param => !param.private); - } - } + ...mapGetters(['userRoles', 'config', 'well', 'wellLicence', 'storedWellId', 'codes']) }, methods: { handlePrint () { From 7bf5a44ab31fd975b3a6a3240be7a153c3ab4b9e Mon Sep 17 00:00:00 2001 From: luna <5862lunamoon@gmail.com> Date: Wed, 6 Nov 2024 15:44:11 -0800 Subject: [PATCH 3/6] private field for aquifer params --- frontend/src/wells/views/WellDetail.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/wells/views/WellDetail.vue b/frontend/src/wells/views/WellDetail.vue index ea6ec4589..892a46514 100644 --- a/frontend/src/wells/views/WellDetail.vue +++ b/frontend/src/wells/views/WellDetail.vue @@ -490,14 +490,14 @@ Licensed under the Apache License, Version 2.0 (the "License"); { key: 'pumping_test_description', label: 'Description' }, { key: 'test_duration', label: 'Test Duration (min)' }, { key: 'boundary_effect', label: 'Boundary Effect' }, - { key: 'private', label: 'Private' }, { key: 'storativity', label: 'Storativity' }, { key: 'transmissivity', label: 'Transmissivity (m²/day)' }, { key: 'hydraulic_conductivity', label: 'Hydraulic Conductivity (m/day)' }, { key: 'specific_yield', label: 'Specific Yield' }, { key: 'specific_capacity', label: 'Specific Capacity (L/s/m)' }, { key: 'analysis_method', label: 'Analysis Method' }, - { key: 'comments', label: 'Comments' } + { key: 'comments', label: 'Comments' }, + ( userRoles.wells.edit ? [{ key: 'private', label: 'Private' }] : []) ]" show-empty>