From 40da392fe4865aa32c4b036136258adede009304 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 1 Dec 2023 09:39:44 -0800
Subject: [PATCH 1/5] pull codes from store to populate fields
---
app/frontend/src/wells/views/WellDetail.vue | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/frontend/src/wells/views/WellDetail.vue b/app/frontend/src/wells/views/WellDetail.vue
index b0401b925..6825cbddc 100644
--- a/app/frontend/src/wells/views/WellDetail.vue
+++ b/app/frontend/src/wells/views/WellDetail.vue
@@ -502,9 +502,9 @@ Licensed under the Apache License, Version 2.0 (the "License");
{{codeToDescription('pumping_test_description_codes', data.item.pumping_test_description)}}
{{codeToDescription('boundary_effect_codes', data.item.boundary_effect)}}
{{codeToDescription('analysis_method_codes', data.item.analysis_method)}}
- {{parseFloat(data.item.storativity).toString()}}
- {{parseFloat(data.item.transmissivity).toString()}}
- {{parseFloat(data.item.hydraulic_conductivity).toString()}}
+ {{data.item.storativity && parseFloat(data.item.storativity).toString()}}
+ {{data.item.transmissivity && parseFloat(data.item.transmissivity).toString()}}
+ {{data.item.hydraulic_conductivity && parseFloat(data.item.hydraulic_conductivity).toString()}}
@@ -541,7 +541,7 @@ import Documents from '@/wells/components/Documents.vue'
import convertCoordinatesMixin from '@/common/convertCoordinatesMixin.js'
import ApiService from '@/common/services/ApiService.js'
import codeToDescription from '@/common/codeToDescription.js'
-
+import { FETCH_CODES } from '@/submissions/store/actions.types.js'
import { RESET_WELL_DATA } from '@/wells/store/actions.types.js'
import { SET_WELL_RECORD, SET_WELL_LICENCE } from '@/wells/store/mutations.types.js'
@@ -689,7 +689,7 @@ export default {
},
created () {
this.fetchSurveys()
-
+ this.$store.dispatch(FETCH_CODES)
if (this.id === null) {
this.error = `Unable to load well '${this.id}'`
}
From 8480031608a4b38118675a8be68ee755d183b4b5 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 1 Dec 2023 09:40:06 -0800
Subject: [PATCH 2/5] create command to update pumping_test_codes
---
.../update_pumping_test_description_codes.py | 20 +++++++++++++++++++
.../pumping_test_description_codes.json | 12 +++++------
2 files changed, 26 insertions(+), 6 deletions(-)
create mode 100644 app/backend/wells/management/commands/update_pumping_test_description_codes.py
diff --git a/app/backend/wells/management/commands/update_pumping_test_description_codes.py b/app/backend/wells/management/commands/update_pumping_test_description_codes.py
new file mode 100644
index 000000000..d95d2cfd9
--- /dev/null
+++ b/app/backend/wells/management/commands/update_pumping_test_description_codes.py
@@ -0,0 +1,20 @@
+from django.core.management.base import BaseCommand
+from wells.models import PumpingTestDescriptionCode
+from collections import defaultdict
+import json
+
+class Command(BaseCommand):
+
+ def __init__(self):
+ pass
+
+ def update_pumping_test_description_codes(self):
+ pumping_test_description_codes = open("wells/migrations/pumping_test_description_codes.json")
+ pumping_codes = json.load(pumping_test_description_codes)
+ for entry in pumping_codes:
+ print(entry['fields']['description'])
+ PumpingTestDescriptionCode.objects.update_or_create(pk=entry["pk"], defaults=entry["fields"])
+
+
+ def handle(self, *args, **options):
+ self.update_pumping_test_description_codes()
diff --git a/app/backend/wells/migrations/pumping_test_description_codes.json b/app/backend/wells/migrations/pumping_test_description_codes.json
index ba67087df..6c14a522d 100644
--- a/app/backend/wells/migrations/pumping_test_description_codes.json
+++ b/app/backend/wells/migrations/pumping_test_description_codes.json
@@ -20,7 +20,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "PT - Pumping Well",
+ "description": "Pumping Test - Pumping Well",
"display_order": 1,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -34,7 +34,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "PT - Observation Well",
+ "description": "Pumping Test - Observation Well",
"display_order": 2,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -48,7 +48,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Recovery test - pumping well",
+ "description": "Recovery Test - Pumping Well",
"display_order": 3,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -62,7 +62,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Recovery test - observation well",
+ "description": "Recovery Test - Observation Well",
"display_order": 4,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -76,10 +76,10 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Other - Please use comments field",
+ "description": "Other",
"display_order": 5,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
}
}
-]
\ No newline at end of file
+]
From 44803366dbccfef39d88963b0596a42fb2779f02 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 1 Dec 2023 09:41:10 -0800
Subject: [PATCH 3/5] change container name to reduce collision
---
docker-compose.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index c935306d5..0efc76cb7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -220,7 +220,7 @@ services:
### Volumes ###
#############################################################################################
pgadmin:
- container_name: pgadmin
+ container_name: gwells-pgadmin
image: dpage/pgadmin4
ports:
- 5050:80
From ea408aa0c893e03b97eca55c9174a73d381c39e8 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 1 Dec 2023 10:38:14 -0800
Subject: [PATCH 4/5] update / create update_code scripts
---
.../commands/update_analysis_method_codes.py | 16 ++++++++++++++++
.../wells/management/commands/update_codes.py | 19 +++++++++++++++++++
.../update_pumping_test_description_codes.py | 7 ++-----
3 files changed, 37 insertions(+), 5 deletions(-)
create mode 100644 app/backend/wells/management/commands/update_analysis_method_codes.py
create mode 100644 app/backend/wells/management/commands/update_codes.py
diff --git a/app/backend/wells/management/commands/update_analysis_method_codes.py b/app/backend/wells/management/commands/update_analysis_method_codes.py
new file mode 100644
index 000000000..9c6038917
--- /dev/null
+++ b/app/backend/wells/management/commands/update_analysis_method_codes.py
@@ -0,0 +1,16 @@
+from django.core.management.base import BaseCommand
+from wells.models import AnalysisMethodCode
+from collections import defaultdict
+import json
+
+class Command(BaseCommand):
+ help = "Update values in the analysis_method_code table"
+ def update_analysis_method_codes(self):
+ analysis_method_codes = open("wells/migrations/analysis_method_codes.json")
+ analysis_codes = json.load(analysis_method_codes)
+ for entry in analysis_codes:
+ AnalysisMethodCode.objects.update_or_create(pk=entry["pk"], defaults=entry["fields"])
+
+ def handle(self, *args, **options):
+ self.update_analysis_method_codes()
+ print("update_analysis_method_codes.py completed successfully")
diff --git a/app/backend/wells/management/commands/update_codes.py b/app/backend/wells/management/commands/update_codes.py
new file mode 100644
index 000000000..bca995185
--- /dev/null
+++ b/app/backend/wells/management/commands/update_codes.py
@@ -0,0 +1,19 @@
+from django.core.management import call_command
+from django.core.management.base import BaseCommand
+import os, fnmatch
+
+class Command(BaseCommand):
+ file_pattern = 'update_*_codes.py'
+ folder_path = './wells/management/commands'
+ help = f'Run all commands using the {file_pattern} format'
+
+
+ def handle(self, *args, **options):
+ matching_files = []
+ for file_name in os.listdir(self.folder_path):
+ if fnmatch.fnmatch(file_name, self.file_pattern):
+ matching_files.append(file_name)
+ print(len(matching_files), "files found")
+ for file_path in matching_files:
+ call_command(file_path.replace(".py",""))
+ print("update_codes has completed successfully")
diff --git a/app/backend/wells/management/commands/update_pumping_test_description_codes.py b/app/backend/wells/management/commands/update_pumping_test_description_codes.py
index d95d2cfd9..a38f2d692 100644
--- a/app/backend/wells/management/commands/update_pumping_test_description_codes.py
+++ b/app/backend/wells/management/commands/update_pumping_test_description_codes.py
@@ -4,17 +4,14 @@
import json
class Command(BaseCommand):
-
- def __init__(self):
- pass
+ help = "Update values in the pumping_test_description_code table"
def update_pumping_test_description_codes(self):
pumping_test_description_codes = open("wells/migrations/pumping_test_description_codes.json")
pumping_codes = json.load(pumping_test_description_codes)
for entry in pumping_codes:
- print(entry['fields']['description'])
PumpingTestDescriptionCode.objects.update_or_create(pk=entry["pk"], defaults=entry["fields"])
-
def handle(self, *args, **options):
self.update_pumping_test_description_codes()
+ print("update_pumping_test_description_codes.py completed successfully")
From 28d8940fe372cbccb561f7e313c68358bdd375b8 Mon Sep 17 00:00:00 2001
From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com>
Date: Fri, 1 Dec 2023 10:38:39 -0800
Subject: [PATCH 5/5] update values for ticket 2045 specs
---
app/backend/wells/migrations/analysis_method_codes.json | 4 ++--
.../wells/migrations/pumping_test_description_codes.json | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/backend/wells/migrations/analysis_method_codes.json b/app/backend/wells/migrations/analysis_method_codes.json
index ec82c037f..c55d15582 100644
--- a/app/backend/wells/migrations/analysis_method_codes.json
+++ b/app/backend/wells/migrations/analysis_method_codes.json
@@ -90,10 +90,10 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Other - Please use comments field",
+ "description": "Other",
"display_order": 6,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
}
}
-]
\ No newline at end of file
+]
diff --git a/app/backend/wells/migrations/pumping_test_description_codes.json b/app/backend/wells/migrations/pumping_test_description_codes.json
index 6c14a522d..fbee9a28b 100644
--- a/app/backend/wells/migrations/pumping_test_description_codes.json
+++ b/app/backend/wells/migrations/pumping_test_description_codes.json
@@ -20,7 +20,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Pumping Test - Pumping Well",
+ "description": "Pumping test - pumping well",
"display_order": 1,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -34,7 +34,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Pumping Test - Observation Well",
+ "description": "Pumping test - observation well",
"display_order": 2,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -48,7 +48,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Recovery Test - Pumping Well",
+ "description": "Recovery test - pumping well",
"display_order": 3,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"
@@ -62,7 +62,7 @@
"create_date": "2023-03-31T17:42:52.421Z",
"update_user": "DATALOAD_USER",
"update_date": "2023-03-31T17:42:52.421Z",
- "description": "Recovery Test - Observation Well",
+ "description": "Recovery test - observation well",
"display_order": 4,
"effective_date": "2013-11-07T05:28:00.402Z",
"expiry_date": "9999-12-31T23:59:59Z"