Skip to content

Commit

Permalink
feat(frontend): #2274 Private Toggle for Aquifer Parameters on Well D…
Browse files Browse the repository at this point in the history
…etails Page (#178)

Co-authored-by: raarielgrace <[email protected]>
  • Loading branch information
lunamoonmoon and raarielgrace authored Nov 20, 2024
1 parent 9304a78 commit d53e5a8
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 1 deletion.
123 changes: 123 additions & 0 deletions backend/wells/migrations/0150_auto_20241108_2357.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
5 changes: 5 additions & 0 deletions backend/wells/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions backend/wells/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class Meta:
'pumping_test_description',
'test_duration',
'boundary_effect',
'private',
'storativity',
'transmissivity',
'hydraulic_conductivity',
Expand All @@ -217,6 +218,7 @@ class Meta:
'pumping_test_description',
'test_duration',
'boundary_effect',
'private',
'storativity',
'transmissivity',
'hydraulic_conductivity',
Expand All @@ -236,6 +238,7 @@ class Meta:
'pumping_test_description',
'test_duration',
'boundary_effect',
'private',
'storativity',
'transmissivity',
'hydraulic_conductivity',
Expand Down
8 changes: 8 additions & 0 deletions backend/wells/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ def get(self, request, *args, **kwargs):
response = super().get(self, request, *args, **kwargs)
if not(request.user.groups.filter(name=WELLS_VIEWER_ROLE).exists()):
response.data.pop('internal_comments')

""" Removes aquifer paramaters marked private for users without the edit role """
if not request.user.groups.filter(name=WELLS_EDIT_ROLE).exists():
aquifer_params = response.data.get('aquifer_parameters_set', [])
response.data['aquifer_parameters_set'] = [
param for param in aquifer_params if not param.get('private', False)
]

return response


Expand Down
1 change: 1 addition & 0 deletions frontend/src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
<th class="font-weight-normal top-row-no-border" scope="col">Test Description</th>
<th class="font-weight-normal top-row-no-border" scope="col">Test Duration (min)</th>
<th class="font-weight-normal top-row-no-border" scope="col">Boundary Effect</th>
<th class="font-weight-normal top-row-no-border" scope="col">This Information is Private</th>
</tr>
<tr>
<td>
Expand Down Expand Up @@ -84,6 +85,9 @@ Licensed under the Apache License, Version 2.0 (the "License");
:errors="errors['boundary_effect']"
:loaded="fieldsLoaded['boundary_effect']"/>
</td>
<td>
<b-form-checkbox v-model="aquiferParameter.private" name="private" :value="true" :unchecked-value="false"/>
</td>
</tr>
<tr>
<th class="font-weight-normal" scope="col">Analysis Method</th>
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/wells/views/WellDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
{ key: 'specific_capacity', label: 'Specific Capacity (L/s/m)' },
{ key: 'analysis_method', label: 'Analysis Method' },
{ key: 'comments', label: 'Comments' },
{ key: 'internal_comments', label: 'Internal Comments' }
( userRoles.wells.edit ? [{ key: 'private', label: 'Private' }] : [])
]"
show-empty>
<template v-slot:head(pumping_test_description)="data">
Expand All @@ -511,6 +511,11 @@ Licensed under the Apache License, Version 2.0 (the "License");
<i id="boundary_effect" class="fa fa-question-circle color-info fa-xs pt-0 mt-0 d-print-none" ></i>
<b-popover no-arrow target="boundary_effect" placement="top" triggers="hover focus" :content="TOOLTIP_TEXT.pumping_test_information.boundary_effect" ></b-popover>
</template>
<template v-slot:head(private)="data">
<span>{{ data.label }}</span>&nbsp;
<i id="private" class="fa fa-question-circle color-info fa-xs pt-0 mt-0 d-print-none" ></i>
<b-popover no-arrow target="private" placement="top" triggers="hover focus" :content="TOOLTIP_TEXT.pumping_test_information.private" ></b-popover>
</template>
<template v-slot:head(storativity)="data">
<span>{{ data.label }}</span>&nbsp;
<i id="storativity" class="fa fa-question-circle color-info fa-xs pt-0 mt-0 d-print-none" ></i>
Expand Down Expand Up @@ -543,6 +548,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
</template>
<template v-slot:cell(pumping_test_description)="data">{{codeToDescription('pumping_test_description_codes', data.item.pumping_test_description)}}</template>
<template v-slot:cell(boundary_effect)="data">{{codeToDescription('boundary_effect_codes', data.item.boundary_effect)}}</template>
<template v-slot:cell(private)="data">{{data.item.private ? 'Yes' : 'No'}}</template>
<template v-slot:cell(analysis_method)="data">{{codeToDescription('analysis_method_codes', data.item.analysis_method)}}</template>
<template v-slot:cell(storativity)="data">{{data.item.storativity && parseFloat(data.item.storativity).toString()}}</template>
<template v-slot:cell(transmissivity)="data">{{data.item.transmissivity && parseFloat(data.item.transmissivity).toString()}}</template>
Expand Down

0 comments on commit d53e5a8

Please sign in to comment.