A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

WHOI HABhub Data Portal

Is being developed as a data access and visualization portal for the New England Harmful Algal Bloom Observing Network.
https://github.com/WHOIGit/whoi-hab-hub

Category: Biosphere
Sub Category: Marine Life and Fishery

Keywords from Contributors

transforms archiving measur generic animals conversion observation optimize compose projection

Last synced: about 19 hours ago
JSON representation

Repository metadata

Harmful Algal Bloom data API and map project

README.md

WHOI HABhub Data Portal

License: GPL v3

Harmful Algal Bloom data API and map project. Our current version for Public Beta is now live! https://habhub.whoi.edu/

The "HABhub" data portal is being developed as a data access and visualization portal for the New England Harmful Algal Bloom Observing Network (neHABON).

There are two separate applications that comprise the HABhub:

  • a backend data server that provides a REST API. Built using the Django Python framework. You can find this app in the habhub-dataserver directory.
  • a frontend client to visualize the data with an interactive map and charts. Built with the React JS framework. Located in the habhub-react-frontend directory.

These applications can run together on a shared machine as a single service or be set up independently of each other. The frontend client only needs to be configured with the base URL of the backend data server to access its API.

Local Deployment with Docker

This project is configured to be deployed both locally and in production using Docker and Docker Compose. The default local deployment uses Docker Compose to run both applications in a single network from one local.yml compose file.

Steps for initial Local Deployment:

  1. Docker and Docker Compose installed: instructions
  2. Clone repo to your local computer: git clone https://github.com/WHOIGit/whoi-hab-hub.git
  3. Create local .env files for both Django data server and React frontend client. Continued below...

Step 3 details

HABhub uses environmental variables for configs such as API links, API tokens, and secrets like database usernames/passwords.
These variable should NOT be kept in version control.

For the Django Data Server

The habhub-dataserver directory contains the Django backend application. This directory also includes a .envs.example directory that you can use as
a template to create your own .envs directory and files. HABhub requires this ".envs" directory to be in the Django application root level directory. (ex. environmental variables file path: habhub-dataserver/.envs/.local/.django)

Final directory structure:

habhub-dataserver
-- .envs/
    -- .local/
      -- .django
      -- .postgres
    -- .production/
      -- .django
      -- .postgres

For the React Frontend Client

The habhub-react-frontend directory contains the React frontend application. Create a new default .env file in this directory using the provided .env.example file as a template. You can also use the example .env.development and .env.production files to set different values for environmental variables depending on the environment. Any variable named in one of these environment specific files will be used instead of the default value in the regular .env file.

The required environmental variables are:

  • REACT_APP_API_URL
  • REACT_APP_MAPBOX_TOKEN

The REACT_APP_API_URL is the base URL of the HABhub data server you want to use. In the default local set up, this is http://localhost:8000/

The REACT_APP_MAPBOX_TOKEN is the API token for Mapbox access. To get a Mapbox GL JS token, create an account here

You can also change the default initial map configuration settings for both the latitude/longitude and zoom:

  • REACT_APP_MAP_LATITUDE
  • REACT_APP_MAP_LONGITUDE
  • REACT_APP_MAP_ZOOM

Step 4

Open your terminal and cd to the root level of the whoi-hab-hub directory. Run the following Docker Compose commands:

docker-compose -f local.yml build
docker-compose -f local.yml up

For the Django app, you need to run the initial DB migrations. Open up a second terminal and run:

docker-compose -f local.yml run --rm django python manage.py migrate

Then create the initial superuser, run:

docker-compose -f local.yml run --rm django python manage.py createsuperuser

The frontend map application will now be available at: http://localhost:3000/

The backend data server will be available at: http://localhost:8000/

To access the Django admin system, login with your new superuser credentials at: http://localhost:8000/admin

Initial HABHub Data Server Configuration

Login to the Django admin panel to access the HABHub Data Server settings.

There are two Core data models that need to be configured to work with the HABHub React Frontend Client and the IFCB Dashboard.

Data Layers

These are the different data layers that are available to display on the frontend HABHub map. By default, all of them are active. To remove a data layer from the frontend map, edit it and simply uncheck the "Is Active" checkbox.

http://localhost:8000/admin/core/datalayer/

Target Species

This is the list of HAB species that are available for both data ingestion from a IFCB Dashboard and to interact with in the frontend map.

http://localhost:8000/admin/core/targetspecies/

The default list is pre-configured with the six species of interest from the main https://habhub.whoi.edu/ site. To ingest IFCB data for a species from an IFCB Dashboard, you just need to make sure that the "species_id" field matches the text string that is used in the IFCB dashboard Autoclass files to identify the species. Ex. file: https://habon-ifcb.whoi.edu/harpswell/D20200221T223958_IFCB000_class_scores.csv

You can also choose the primary color for each species for display on the map. A color gradient using that color is automatically created when you change a species color

IFCB Datasets Layer

To configure this data layer, you need to first create some Dataset objects in the admin panel:

http://localhost:8000/admin/ifcb_datasets/dataset/

These Datasets should match with an existing Dataset in your IFCB Dashboard. The "Dashboard id name" field needs to be set to the unique ID from the IFCB Dashboard. This can be found in the IFCB Dashboard URL for the dataset, ex: https://habon-ifcb.whoi.edu/timeline?dataset=harpswell, or at the bottom of the "Basic Info" box in the Dashboard.

Once a Dataset is created in HABhub, data from the Target Species will begin to automatically be ingested on an hourly basis. No further configuration is necessary.

Shellfish Toxicity Layer

First create some geographic Station locations in the admin panel that are providing Shellfish Toxicity data. You can then import data from a CSV for each Station using the Datapoint importer:

http://localhost:8000/admin/stations/datapoint/import/

Closures Layer

This layer is very dependent on specific state government data and protocols. Example data is available for some New England states, but this layer requires custom set up for new states and is still under development.

Steps to update Local Deployment:

To update your local version with the latest code changes from the main repo branch, take the following steps:

  1. cd to the project root directory
  2. git pull to get the latest version
  3. docker-compose -f local.yml down
  4. docker-compose -f local.yml build
  5. docker-compose -f local.yml up --renew-anon-volumes (the --renew-anon-volumes option makes sure that your local node_modules volume is updated with any package changes.)

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: WHOI HAB hub
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Ethan
    family-names: Andrews
    email: [email protected]
    affiliation: Woods Hole Oceanographic Institution
  - given-names: Claire
    family-names: Anacreon
    email: [email protected]
    affiliation: Woods Hole Oceanographic Institution
  - given-names: Kali
    family-names: Horn
    email: [email protected]
    affiliation: Woods Hole Oceanographic Institution
  - given-names: Mindy
    family-names: Richlen
    email: [email protected]
    affiliation: Woods Hole Oceanographic Institution
    orcid: 'https://orcid.org/0000-0002-1302-9342'
  - given-names: Michael
    family-names: Brosnahan
    email: [email protected]
    affiliation: Woods Hole Oceanographic Institution
    orcid: 'https://orcid.org/0000-0002-2620-7638'
repository-code: 'https://github.com/WHOIGit/whoi-hab-hub.git'
license: GPL-3.0
commit: >-
  https://github.com/WHOIGit/whoi-hab-hub/commit/1cbd55c803b581b11efb296c7494af285946254a
version: '1'
date-released: '2025-01-22'

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 838
Total Committers: 7
Avg Commits per committer: 119.714
Development Distribution Score (DDS): 0.019

Commits in past year: 35
Committers in past year: 2
Avg Commits per committer in past year: 17.5
Development Distribution Score (DDS) in past year: 0.029

Name Email Commits
ethanandrews e****s@w****u 822
dependabot[bot] 4****] 8
ewandrews e****n@h****m 4
Ryan Govostes r****v 1
Michael Brosnahan m****s@w****u 1
Ethan Andrews e****s@E****l 1
ETHAN ANDREWS e****s@h****u 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 23
Total pull requests: 20
Average time to close issues: 6 months
Average time to close pull requests: 4 months
Total issue authors: 5
Total pull request authors: 2
Average comments per issue: 0.48
Average comments per pull request: 0.55
Merged pull request: 9
Bot issues: 0
Bot pull requests: 19

Past year issues: 0
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 1

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/WHOIGit/whoi-hab-hub

Top Issue Authors

  • mbrosnahan (13)
  • kalimhorn (4)
  • canacreon (3)
  • ethanandrews (2)
  • mrun0205 (1)

Top Pull Request Authors

  • dependabot[bot] (19)
  • rgov (1)

Top Issue Labels

  • enhancement (1)

Top Pull Request Labels

  • dependencies (19)
  • javascript (9)
  • python (2)

Dependencies

habhub-react-frontend/package-lock.json npm
  • 1614 dependencies
habhub-react-frontend/package.json npm
  • eslint ^7.22.0 development
  • eslint-plugin-react ^7.22.0 development
  • @date-io/date-fns 1.x
  • @material-ui/core ^4.11.0
  • @material-ui/icons ^4.9.1
  • @material-ui/pickers ^3.2.10
  • @reduxjs/toolkit ^1.5.0
  • @testing-library/jest-dom ^5.11.4
  • @testing-library/react ^11.1.0
  • @testing-library/user-event ^12.1.10
  • @turf/bbox-polygon ^6.4.0
  • @turf/boolean-intersects ^6.4.0
  • @turf/centroid ^6.4.0
  • @turf/points-within-polygon ^6.4.0
  • @turf/square-grid ^6.4.0
  • axios ^0.21.1
  • clsx ^1.1.1
  • date-fns ^2.16.1
  • ga-4-react ^0.1.281
  • highcharts ^9.1.0
  • highcharts-react-official ^3.0.0
  • html2canvas ^1.0.0-rc.7
  • immutability-helper ^3.1.1
  • material-ui-color ^1.2.0
  • material-ui-popup-state ^1.9.0
  • prop-types ^15.7.2
  • react ^17.0.1
  • react-dnd ^16.0.1
  • react-dnd-html5-backend ^16.0.1
  • react-dom ^17.0.1
  • react-draggable ^4.4.5
  • react-ga ^3.3.0
  • react-map-gl ^5.2.9
  • react-redux ^7.2.3
  • react-router-dom ^6.2.1
  • react-scripts 4.0.3
  • uuid ^8.3.2
  • web-vitals ^0.2.4
habhub-dataserver/requirements/base.txt pypi
  • colour ==0.1.5
  • django-celery-beat ==2.2.1
  • django-colorfield ==0.4.1
  • django-filter ==21.1
  • django-geojson ==3.0.0
  • django-import-export ==2.4.0
  • django-leaflet ==0.27.1
  • django-multiselectfield ==0.1.12
  • django-rest-multiple-models ==2.1.3
  • django-summernote ==0.8.11.6
  • djangorestframework-camel-case ==1.2.0
  • djangorestframework-csv ==2.1.0
  • geopy ==2.0.0
  • hiredis ==2.0.0
  • jsonfield ==3.1.0
  • requests ==2.24.0
  • s2sphere ==0.2.5
compose/local/django/Dockerfile docker
  • python 3.8-slim-buster build
compose/local/react-frontend/Dockerfile docker
  • node 16 build
compose/production/django/Dockerfile docker
  • python 3.8-slim-buster build
compose/production/postgres/Dockerfile docker
  • postgis/postgis 12-3.1-alpine build
compose/production/react-frontend/Dockerfile docker
  • nginx alpine build
  • node 14 build
docker-compose-demo.yml docker
docker-compose-prod.yml docker
docker-compose-staging.yml docker
habhub-dataserver/requirements/local.txt pypi
habhub-dataserver/requirements/production.txt pypi

Score: 4.430816798843313