gwells

Groundwater Wells and Aquifers application for the Ministry of Environment

https://github.com/bcgov/gwells

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary

Keywords

bcgov-csnr dds django env groundwater-data vuejs

Keywords from Contributors

fuel tran transfer empr tra nrm low fue fu credits
Last synced: 6 months ago · JSON representation

Repository

Groundwater Wells and Aquifers application for the Ministry of Environment

Basic Info
Statistics
  • Stars: 31
  • Watchers: 13
  • Forks: 36
  • Open Issues: 102
  • Releases: 8
Topics
bcgov-csnr dds django env groundwater-data vuejs
Created almost 9 years ago · Last pushed 8 months ago
Metadata Files
Readme License Code of conduct Codeowners

README.md

img

Groundwater Wells and Aquifers (GWELLS)

https://apps.nrs.gov.bc.ca/gwells/

Introduction

The Ministry of Environment receives and processes groundwater data and information related to the construction, alteration and decommissioning of groundwater wells. Well construction and reporting requirements are regulated under the Water Sustainability Act and Groundwater Protection Regulation. The information collected and stored is used by government and other users to help inform decisions related to the management of the groundwater resource in B.C.

GWELLS, the new groundwater data repository, aims to improve the user experience when submitting and searching for well information, to improve the quality of the data being submitted, and to improve the overall functionality of the system to meet user and regulatory requirements.

The application is being developed as an open source solution.

Table of Contents

  1. Using the GWELLS API
  2. DataBC Export
  3. Developing GWELLS
  4. Architecture
  5. Contributing
  6. License

Using the GWELLS API

GWELLS maintains a REST API where public data relating to wells is made available for other applications and services.

Our Swagger documentation is available at https://apps.nrs.gov.bc.ca/gwells/api/. Some examples of GWELLS endpoints:

Wells:

```sh

all wells (paginated)

curl https://apps.nrs.gov.bc.ca/gwells/api/v1/wells

all wells in an area bounded by swlat, swlong, nelat, and nelong

curl https://apps.nrs.gov.bc.ca/gwells/api/v1/wells?swlat=51.599253&swlong=-128.220340&nelat=52.108192&nelong=-127.150547 ```

Aquifers:

```sh

all aquifers

curl https://apps.nrs.gov.bc.ca/gwells/api/v1/aquifers ```

See the Swagger documentation for more examples.

DataBC Export

GWELLS Api is used by DataBC to export model information and provide well information on the DataBC website.

The command located in app/backend/gwells/management/commands/export_databc.py is used to pull data from the gwells database and export it for consumption in DataBC.

If a new field(s) are needed for export, this exportdatabc.py has raw sql queries that need to be updated with the required fields. Descriptions are also needed for the swagger documentation that are pulled from the dbcomment fields in the django models. Both the raw sql queries and the db_comment field on the model need to be updated for new fields.

Developing GWELLS

Setup Prerequisites

Software Requirements

  • Docker Desktop
  • Node

Actions to take:

Connecting to Minio

For gwells to interact with your local instance of Min.IO add the appropriate settings to your local machines HOSTS file:

127.0.0.1 minio-public 127.0.0.1 minio-private

Authentication

Some GWELLS pages (submitting new well reports, adding or editing aquifers, or adding or editing qualified well drillers to the registry) require authentication. Authentication uses the Province's Single Sign-On system. A GWELLS team member can request access for collaborators if needed.

Running the GWELLS application locally

Login to Artifactory for pulling the backend base image:

sh docker login -u <svc-usn> -p <svc-pwd> artifacts.developer.gov.bc.ca/g26e-backend-docker-local

Replace svc-usn and svc-pwd with Artifactory service account credentials obtained from Openshift (under artifacts-default-tulivf secrets)

Then, run the application with Docker:

sh cd gwells docker-compose up

Running GWELLS locally with a connection to Staging's Database

To have a more complete dataset while running locally, you can opt to point the backend at GWELLS' staging database while using the BC Government VPN. This will provide a more robust dataset for debugging or feature testing.

  1. Duplicate .env.template and rename the new file as .env.test

  2. Using the database secrets from GWELLS' staging namespace on OpenShift, replace the variables in your new .env.test file. You'll need to change ENVIRONMENT to 'test' as well to ensure the proper command is run from the app/scripts/backend-command-script.sh file.

    Note: to get the GWELLS_SERVICE_HOST and GWELLS_SERVICE_PORT, use the oc CLI and login to GWELLS' test namespace; run the following command to view the TransportServer for the staging database:

    ``` oc project 26e83e-test

    oc -n 26e83e-test get ts ```

    This should print out a VIRTUALSERVERADDRESS (the GWELLS_SERVICE_HOST) and a VIRTUALSERVERPORT (the GWELLS_SERVICE_PORT)

    NAME VIRTUALSERVERADDRESS VIRTUALSERVERPORT POOL POOLPORT IPAMLABEL IPAMVSADDRESS STATUS AGE yourservice-tsc 142.34.194.68 65555 yourservice 8000 None Ok 21d

    Your .env.test file should look something like this:

    ```

    .env for test environment

    ENVIRONMENT=test APITARGET=http://backend:8000/ DATABASEUSER= DATABASEPASSWORD= GWELLSSERVICEHOST=142.34.194.68 GWELLSSERVICE_PORT= ```

  3. Once .env.test has the proper environment variables, run the docker-compose up command with the --env-file flag:

    docker-compose --env-file ./.env.test up

You should now have a local build with a backend that points to staging's database. Be mindful when saving or changing data to the staging database.

If you're encountering any issues with the build, ensure that your VPN is connected and working properly.

Minio doesn't download while connected using the VPN. This is a known issue.

Running GWELLS in Debug Mode

Ensure you have a launch.json file in the .vscode directory.

json { "version": "0.2.0", "configurations": [ { "name": "Remote Django App", "type": "python", "request": "attach", "pathMappings": [ { "localRoot": "${workspaceFolder}/app/backend", "remoteRoot": "/app/backend" } ], "port": 3000, "host": "localhost" } ] }

In VS Code, press F5 or go to Run > Start Debugging to run in debug mode.

You can now add breakpoints within GWELLS - more information about debugging in VS Code here.

Connecting to PGAdmin

Information in this section reflects docker-compose as of Nov 8th, 2023

PG Admin is setup in the docker-compose up and requires no additional installations

Steps:

  1. Connect to Pgadmin through localhost
  2. Login using username: admin@gwells.com, password: admin
  3. Right click Server -> Register -> Server
  4. Enter any meaningful name in Name
  5. Under the Connection tab supply the following values

| Field | Value | | ------------------- | -------- | | Host name / address | db | | Port | 5432 | | Username | gwells | | Password | test1 |

Visit the following links to browse the API and frontend applications:

  • Django REST API development server: http://localhost:8000/gwells/api/
  • Vue frontend development server: http://localhost:8080/

Running tests:

For comprehensive testing information visit the Wiki Postman API tests: Import the json test collections in the api-tests/ folder into Postman.

Import a Shapefile

Single shapefile, with aquifer ID specified in CLI.

docker-compose exec backend python manage.py import_shapefile 2 aquifers/fixtures/shp/shapefile.zip

Bulk import, requires the AQ_NUMBER attribute on each polygon. Requires a folder with shapefiles to be prepared and passed in (zipped or not). Note: if DEBUG=True, all geometries will be uploaded to a random aquifer instead of the one matching its' number, so we can test locally with a development database.

``` mkdir app/backend/bulk mv DATABCEXPORTFILE.zip app/backend/bulk/

docker-compose exec backend python manage.py importbulkshapefile bulk ```

Importing Licences

To download new licence data from DataBC and merge it into your DB, do

docker-compose exec backend python manage.py import_licences

Making pull requests

Pull requests made from branches in the bcgov/gwells repo will kick off a dev pipeline, which runs tests and deploys a preview environment containing your changes. The pull request page will update when the environment is deployed and mandatory checks (unit tests, etc.) pass or fail.

Architecture

GWELLS uses PostgreSQL (with PostGIS), Django REST Framework, and Vue.js. We also use both AWS S3 and a self-hosted Minio service for storing documents.

Our production and staging environments run on an OpenShift container platform cluster. OpenShift templates for services are located in the openshift/ folder, along with more information about dev and staging environments on our cluster.

GWELLS container diagram

Contributing

Government employees, the public and members of the private sector are encouraged to contribute. Please read and follow our Code of Conduct.

All contributors retain original copyright, but are granting a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users. This project is covered by an Apache v2.0 license.

Code With Us

Many of our features have been developed by members of the community. Check the BC Developer Exchange website, where paid opportunities to build features for GWELLS and other applications are posted.

License

Code released under the Apache License, Version 2.0.

Additional Documentation

More documentation for the repository can be found in the following places

New pipeline deployment instructions

Dev Environment

Steps before merging Pull Request into 'release': 1. Login to OpenShift

  1. Navigate to '26e83e-tools' in projects

alt text

  1. Make sure you are in the administrator view

alt text

  1. Go to Builds -> BuildConfigs

alt text

  1. Find 'gwells-frontend'

alt text

  1. Click on the YAML tab

alt text

  1. Find the 'VITEAXIOSBASE_URL' environment variable and change the url to include 'dev'. (It may currently already say dev, or test or prod)

alt text

  1. Hit 'save'

alt text

  1. You can now merge the Pull Request

  2. A build for the frontend and backend will now be triggered and automatically deploy to the dev environment once built.

Test Environment - Steps before merging Pull Request into 'release': 1. Login to OpenShift

  1. Navigate to '26e83e-tools' in projects

alt text

  1. Make sure you are in the administrator view

alt text

  1. Go to Builds -> BuildConfigs

alt text

  1. Find 'gwells-frontend'

alt text

  1. Click on the YAML tab

alt text

  1. Find the 'VITEAXIOSBASE_URL' environment variable and change the url to include 'test'. (It may currently already say dev, or test or prod)

alt text

  1. Hit 'save'

alt text

  1. You can now merge the Pull Request

Steps after merging Pull Request into 'release':

  1. Once the frontend and backend builds are complete navigate to Pipelines -> Pipelines

alt text

  1. Then select 'promote-to-test'

alt text

  1. Finally Select Actions -> Start

alt text

  1. The frontend and backend will then deploy to the test environment

Prod Environment - Steps before merging Pull Request into 'release': 1. Login to OpenShift

  1. Navigate to '26e83e-tools' in projects

alt text

  1. Make sure you are in the administrator view

alt text

  1. Go to Builds -> BuildConfigs

alt text

  1. Find 'gwells-frontend'

alt text

  1. Click on the YAML tab

alt text

  1. Find the 'VITEAXIOSBASE_URL' environment variable and change the url to include 'prod'. (It may currently already say dev, or test or prod)

alt text

  1. Hit 'save'

alt text

  1. You can now merge the Pull Request

Steps after merging Pull Request into 'release':

  1. Once the frontend and backend builds are complete navigate to Pipelines -> Pipelines

alt text

  1. Then select 'promote-to-prod'

alt text

  1. Finally Select Actions -> Start

alt text

  1. The frontend and backend will then deploy to the prod environment

Owner

  • Name: bcgov
  • Login: bcgov
  • Kind: organization
  • Email: Developer.Experience@gov.bc.ca
  • Location: Canada

This is the home for code that is open

GitHub Events

Total
  • Create event: 98
  • Issues event: 81
  • Watch event: 2
  • Delete event: 91
  • Member event: 1
  • Issue comment event: 54
  • Push event: 165
  • Pull request review comment event: 7
  • Pull request review event: 13
  • Pull request event: 178
Last Year
  • Create event: 98
  • Issues event: 81
  • Watch event: 2
  • Delete event: 91
  • Member event: 1
  • Issue comment event: 54
  • Push event: 165
  • Pull request review comment event: 7
  • Pull request review event: 13
  • Pull request event: 178

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 6,938
  • Total Committers: 71
  • Avg Commits per committer: 97.718
  • Development Distribution Score (DDS): 0.757
Past Year
  • Commits: 219
  • Committers: 5
  • Avg Commits per committer: 43.8
  • Development Distribution Score (DDS): 0.164
Top Committers
Name Email Commits
Steve Hillier s****r@g****m 1,687
Derek Roberts d****s@g****m 668
Sybrand Strauss s****s@g****a 518
Gary Wong (BC Gov) g****g@g****a 410
Roland Stens r****s@g****m 410
AlexZorkin a****x@b****s 396
Séamus O'Connor s****r@p****m 328
Fieran Mason f****n@g****m 310
sgreylyn s****n@g****m 229
Dallas Richmond d****d@g****a 183
LocalNewsTV 6****V 163
Louie C****E@B****V 120
Cole Maclean hi@c****o 110
Ryan Barber r****b@s****u 102
Aaron a****n@c****a 95
Clark Van Oyen c****k@c****a 85
Dan d****n@b****o 84
calouie c****e@g****a 82
acatchpole a****e@g****m 74
Rodolfo Carvalho r****o@g****m 73
Brock Anderson b****k@b****a 71
Daine Trinidad d****d@g****a 57
David 6****u 57
garywong-bc g****g@g****a 51
Sanjay Babu s****u@g****m 50
kuanfandevops 3****s 45
Your Name y****u@e****m 45
GeorgeWalker g****r@q****m 44
Norris Ng 1****c 38
Clécio Varjão 1****o 34
and 41 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 307
  • Total pull requests: 2,256
  • Average time to close issues: 2 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 29
  • Total pull request authors: 45
  • Average comments per issue: 0.94
  • Average comments per pull request: 0.52
  • Merged pull requests: 1,852
  • Bot issues: 3
  • Bot pull requests: 80
Past Year
  • Issues: 61
  • Pull requests: 206
  • Average time to close issues: 20 days
  • Average time to close pull requests: 13 days
  • Issue authors: 10
  • Pull request authors: 7
  • Average comments per issue: 0.49
  • Average comments per pull request: 0.11
  • Merged pull requests: 150
  • Bot issues: 0
  • Bot pull requests: 39
Top Authors
Issue Authors
  • LolandaE (64)
  • QSu-2023 (51)
  • jakemorr (36)
  • Keegnan (32)
  • fergmac (32)
  • LocalNewsTV (20)
  • carmenriddel (11)
  • lunamoonmoon (10)
  • dallascrichmond (8)
  • acatchpole (7)
  • sanjaytkbabu (6)
  • raarielgrace (5)
  • Rebecca-MDS (5)
  • bcdevex (4)
  • norrisng-bc (4)
Pull Request Authors
  • stephenhillier (332)
  • garywong-bc (221)
  • DerekRoberts (209)
  • rstens (208)
  • seamus-oconnor (186)
  • dallascrichmond (160)
  • AlexZorkin (159)
  • Sybrand (157)
  • fieranmason (124)
  • dependabot[bot] (89)
  • LocalNewsTV (85)
  • SethGreylyn (40)
  • danbigthink (35)
  • fergmac (35)
  • acatchpole (29)
Top Labels
Issue Labels
Task (167) Ready (114) User Story (56) Tech Debt (33) Spike (13) bug (12) New Bug (11) Duplicate (9) Old Bug (9) Good first issue (7) PO Follow-Up (4) Cancelled (4) Epic (3) Retro Action (2) No Longer Needed (2) Frontend (2) Backend (2) Testing (1) OpenShift (1) Docker (1) Questions (1) Contract (1) Pipeline (1)
Pull Request Labels
Frontend (246) Backend (122) dependencies (89) javascript (64) Docker (58) OpenShift (39) python (23) Testing (23) Scripts (11) GitHub Actions (2) General (2) Database (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 9
proxy.golang.org: github.com/bcgov/gwells
  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 6 months ago

Dependencies

openshift/sonar-runner/build.gradle maven
  • junit:junit 4.12 testCompile
app/frontend/package-lock.json npm
  • 1479 dependencies
app/frontend/package.json npm
  • @vue/cli-plugin-babel ^3.7.0 development
  • @vue/cli-plugin-eslint ^3.7.0 development
  • @vue/cli-plugin-unit-jest ^3.7.0 development
  • @vue/cli-service ^3.7.0 development
  • @vue/eslint-config-standard ^4.0.0 development
  • @vue/test-utils 1.0.0-beta.29 development
  • babel-core 7.0.0-bridge.0 development
  • babel-eslint ^10.0.1 development
  • babel-jest ^23.6.0 development
  • eslint ^5.16.0 development
  • eslint-plugin-vue ^5.0.0 development
  • jest-transform-stub ^2.0.0 development
  • jquery ^3.4.1 development
  • moxios ^0.4.0 development
  • node-sass ^4.9.0 development
  • sass-loader ^7.1.0 development
  • vue-template-compiler ^2.5.21 development
  • @geolonia/mbgl-gesture-handling ^1.0.13
  • @mapbox/mapbox-gl-geocoder ^4.5.1
  • @sentry/browser ^5.7.1
  • @sentry/integrations ^5.7.1
  • axios ^0.21.1
  • bootstrap-vue ^2.0.0-rc.2
  • browser-update ^3.3.8
  • chart.js ^2.9.4
  • deep-diff ^1.0.2
  • lodash-es ^4.17.15
  • mapbox-gl ^1.10.0
  • papaparse ^5.2.0
  • proj4 ^2.4.4
  • smoothscroll ^0.4.0
  • vue ~2.6.10
  • vue-analytics ^5.16.4
  • vue-chartjs ^3.4.2
  • vue-matomo ^4.0.1
  • vue-moment ^4.1.0
  • vue-router ^3.0.1
  • vue-select ^3.1.0
  • vuejs-noty ^0.1.3
  • vuex ^3.0.1
app/backend/requirements.txt pypi
  • GDAL >=2.4,<3.0
  • coverage >=4.4.2
  • cryptography ==3.3.2
  • deepdiff >=4
  • django >=2.2,<2.3
  • django-cors-headers ==2.2.0
  • django-crispy-forms >=1.6.1
  • django-debug-toolbar >=1.7
  • django-extensions ==2.0.6
  • django-filter >=2.0.0,<2.1
  • django-formtools >=2.0
  • django-rest-multiple-models ==2.1.0
  • django-reversion ==2.0.13
  • django-settings-export >=1.2.1
  • djangorestframework >=3.11.2,<3.12
  • djangorestframework-csv ==2.1.0
  • djangorestframework-jwt ==1.11.0
  • drf-yasg ==1.20.0
  • geojson ==2.4.1
  • gevent ==1.2.2
  • gunicorn ==19.9.0
  • lxml ==4.6.3
  • minio >=4.0.16
  • openpyxl ==2.5.11
  • psycopg2-binary >=2.7.1,<2.9
  • requests ==2.21.0
  • urllib3 >=1.24,<1.25
  • whitenoise >=4.1.2
app/scripts/profanitysearch/requirements.txt pypi
  • inflection ==0.5.0
  • joblib ==0.15.1
  • numpy ==1.18.5
  • profanity-check ==1.0.3
  • profanityfilter ==2.0.6
  • scikit-learn ==0.22.2.post1
  • scipy ==1.4.1
  • threadpoolctl ==2.1.0
docker-compose.yml docker
  • crunchydata/crunchy-postgres-gis centos7-12.2-4.2.2
  • gwells/backend latest
  • node 8.9.4
  • pramsey/pg_tileserv latest
openshift/docker/backend/Dockerfile docker
  • registry.access.redhat.com/rhscl/python-36-rhel7 1 build
openshift/docker/backup-pvc/Dockerfile docker
  • alpine latest build
openshift/docker/minio/Dockerfile docker
  • minio/minio RELEASE.2020-11-25T22-36-25Z build
openshift/docker/pg12-postgis2.5/Dockerfile docker
  • registry.access.redhat.com/rhscl/postgresql-12-rhel7 1-10 build
openshift/jobs/minio-backup/Dockerfile docker
  • alpine latest build
openshift/ocp4/jenkins/docker/Dockerfile docker
  • BuildConfig latest build
openshift/ocp4/jobs/minio-backup/Dockerfile docker
  • alpine latest build
.github/workflows/pr-labeller.yaml actions
  • actions/labeler v4 composite
openshift/ocp4/jenkins/basic/docker/Dockerfile docker
  • registry.access.redhat.com/ubi8/ubi 8.7 build
app/scripts/qaqc/requirements.txt pypi
  • bcdata >=0.4.5
  • geopandas >=0.10
  • jupyterlab >=3.2.1
  • python-levenshtein ==0.12.2
  • rasterio *
  • requests >=2.26
  • thefuzz ==0.19.0