Home

Awesome

Abalone Analytics

rspec rubocop

The Abalone project is a data tracking and analytics system aimed at storing and measuring data for population trends, mortality rates, and breeding programs. Designed as a multi-tenant application, Abalone will initially serve two stakeholders, the Bodega Marine Laboratory at UC Davis and the Puget Sound Restoration Fund in Washington State.

The Bodega Marine Laboratory's White Abalone captive breeding program is working to prevent the extinction of the White Abalone (Haliotis sorenseni), an endangered marine snail. White abalone are one of seven species found in California and are culturally significant to the native people of the area. White abalone were perilously overfished throughout the 20th century, resulting in a 99 percent population decrease by the end of the 1970s. This group is working to reverse their decline and have already seen some great success, they currently have more abalone in the lab than exist in the wild!

The Puget Sound Restoration Fund works to raise and outplant hatchery-reared Pinto Abalone (Haliotis kamtschatkana), the only abalone species found in the Washington waters. This species has cultural and ecological significance, grazing rock surfaces and maintaining the health of rocky reef habitat and kelp beds. The Washington Department of Fish & Wildlife (WDFW) documented a ~98% decline from 1992 to 2017, leading the pinto abalone to be listed as a state endangered species in 2019.

This application will enable groups to add data either through CSV upload or through the web interface. Groups can view reports and visual representations of key data. Future plans include giving groups the ability to generate custom reports on the fly.

<!-- ## Welcome Contributors!! Thank you for checking out the project. We would love to have you contribute! We recommend that you join us in slack https://rubyforgood.herokuapp.com/ #abalone channel. Start by reading our contributing [guide](https://github.com/rubyforgood/abalone/blob/main/CONTRIBUTING.md). Checkout the [Issues tab](https://github.com/rubyforgood/abalone/issues). An issue can be claimed by commenting on it. Explore the [Getting Started](https://github.com/rubyforgood/abalone#getting-started) and [Get Familiar with the App](https://github.com/rubyforgood/abalone#get-familiar-with-the-app) sections to learn more about the application. -->

Getting Started

Prerequisites

This application is built on following and you must have these installed before you begin:

Setup

After forking this repo and cloning your own copy onto your local machine, execute the following commands in your CLI:

gem install bundler
bundle install
yarn install
bin/webpack
rake db:create
rake db:migrate
rake db:seed

Run Test Suite

bundle exec rake

Run Webserver for Abalone

Webpack dependencies can be rebuilt on command with bin/webpack. Alternatively you can run bin/webpack-dev-server in another terminal window. This will effectively run bin/webpack for you whenever files change.

Then, run bundle exec rails s and browse to http://localhost:3000/.

Login information for white abalone:

Email: admin@whiteabalone.com
Password: password

Login information for pinto abalone:

Email: admin@pintoabalone.com
Password: password

Running Background Jobs

The app uses the gem delayed_job for processing CSVs. To run background jobs, run the following command in your CLI:

rake jobs:work

To confirm background jobs are processing, try uploading a CSV at http://localhost:3000/file_uploads/new. You should see the job complete in your CLI and see the file upload results here at http://localhost:3000/file_uploads.

To see detailed logs from background jobs, run:

tail -f log/delayed_job.log

To clear background jobs, run:

rake jobs:clear

Direct SQL Reporting

This application uses a modified implementation of the Blazer gem to provide direct SQL access with data scoped to an organizational level. This requires some setup to use in your development environment. See the instructions for setting this up locally to get started.

Docker

We are currently experimenting with Docker for development. While we would love for more people to try it out, be forewarned - Docker functionality may not be maintained moving forward. You will need Docker and docker-compose.

Starting Fresh

To start the application in development mode:

Or, run only this:

The web app will be available on your host at http://localhost:3000. The logs for the web app and delayed_job processes can be seen and followed with the make watch command.

Some Routine Tasks

Only the Database

Some developers prefer to run the Ruby and Rails processes directly on their host computers instead of running everything in containers. It might still be convenient for those developers to run the database in a container and not deal with the installation of yet another server on their computer. To do so:

Development

We have included the Annotate gem in this project, for better development experience. It annotates (table attributes) models, model specs, and factories.

The annotate task will run automatically when running migrations. Please see lib/tasks/auto_annotate_models.rake for configuration details.

If it does not run automatically, you can run it manually, on the project root dir, with:

annotate

Check out their Github page for more running options.

Architectural Constraints

In submitting features or bug fixes, please do not add new infrastructure components — e.g. databases, message queues, external caches — that might increase operational hosting costs. We are hosting on a free Heroku instance and need to keep it this way for the foreseeable future. Come talk to us if you have questions by posting in the Ruby for Good #abalone slack channel or creating an issue.

Other Considerations

We want it to be easy to understand and contribute to this app, which means we like comments in our code! We also want to keep the codebase beginner-friendly. Please keep this in mind when you are tempted to refactor that abstraction into an additional abstraction.

Get Familiar with the App

Application Overview

<!-- ### Current Status __Last status update: August 2021__ This app is currently in testing with the two initial stakeholder groups. We are working with them to begin using actual data, build initial reports, fix bugs discovered during testing and refine the application. Simultaneously, we are continuing feature work to extend and improve the application. While the core functionality of the application is in place, refactors may be considered as part of the stakeholder testing process. Issues specific to stakeholder testing and onboarding are part of the [Stakeholder Testing and Onboarding](https://github.com/rubyforgood/abalone/milestone/10) milestone. Take a look at the current [Issues](https://github.com/rubyforgood/abalone/issues) and feel free to assign one to yourself and take it on! If you have any questions about requirements, post your question in the issue. -->

The Problem

Our stakeholders, the Bodega Marine Laboratory and the Puget Sound Restoration Fund work with large amounts of data collected as part of their abalone captive breeding programs. They need a system that can act as a central data repository for all of this data and provide robust reporting capabilities to help them examine trends and combine data collected across their research efforts.

The Solution

We are building a multi-tenant application which has the following capabilities:

  1. Store Data: There are several types of measurement data collected that should be stored in the system and retrievable by each organization.
  2. Import CSVs: Users are able to import single and bulk CSVs. Users should generally submit cleaned CSVs, but the app should alert users if there are parsing problems and which row(s) need to be fixed.
  3. Display Charts and Analytics: Display charts and analytics to meet the reporting needs of each organization. Allow organizations to directly query their data.
  4. Export CSVs: TBD.

Key Definitions

See a full data dictionary here.

And Don't Forget...

...that Gary needs you.

a white abalone

Photo credit: John Burgess/The Press Democrat