Skip to content

Commit

Permalink
Documentation updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigJZ committed Sep 6, 2022
1 parent 6739041 commit 2becd12
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ end

# Report builder
gem 'reports_kit' # Replaced by blazer reporting - 1/24/21
# Dependency on Blazer version 2.4.7 due to app-specific overrides living in
# Dependency on Blazer version 2.5.0 due to app-specific overrides living in
# app/overrides that depend on the Blazer code at this version of the gem. Updating
# this gem will require review of our overridden classes with changes to code in the
# desired Blazer gem version.
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ The Puget Sound Restoration Fund works to raise and outplant hatchery-reared [Pi

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!!
<!-- ## 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 to ask questions quickly and hear about office hours (currently Tuesday 6-7pm Eastern), stakeholder news, and upcoming new issues.
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.
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

Expand Down Expand Up @@ -88,10 +88,10 @@ This application uses a modified implementation of the [Blazer](https://github.c

### 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.
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.

* [Docker Desktop](https://www.docker.com/products/docker-desktop) is recommended for Windows and Mac computers.
* The `make` utility can also make your development life easier. It it usually already installed on Linux and Mac computers. For Windows, an easy way to install it is via [Chocolatey](https://chocolatey.org/install), a software package management system similar to Homebrew for Windows. Once Chocolatey is installed, install make with `choco install make` in a command prompt running as Administrator.
* The `make` utility can also make your development life easier. It is usually already installed on Linux and Mac computers. For Windows, an easy way to install it is via [Chocolatey](https://chocolatey.org/install), a software package management system similar to Homebrew for Windows. Once Chocolatey is installed, install make with `choco install make` in a command prompt running as Administrator.
* If you run into issues using Docker Desktop on windows, we recommend you view [this page](https://github.com/mdworken/MKD-Docker-Windows-Rails) for troubleshooting info.

**Starting Fresh**
Expand Down Expand Up @@ -148,15 +148,15 @@ We want it to be easy to understand and contribute to this app, which means we l

[Application Overview](https://github.com/rubyforgood/abalone/blob/main/application_overview.md)

### Current Status
<!-- ### 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.
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.
Expand All @@ -181,8 +181,6 @@ We are building a multi-tenant application which has the following capabilities:

[See a full data dictionary here.](https://github.com/rubyforgood/abalone/wiki/Abalone-Data-Dictionary)

## Deployment
The application is currently deployed on Heroku at https://abalone-staging.herokuapp.com/.

## And Don't Forget...

Expand Down
16 changes: 9 additions & 7 deletions application_overview.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Application Overview

__Last updated to the document: August 2021__
__Last updated to the document: September 2022__

This document provides a general overview of the key parts of the Abalone Analytics application. It is primarily intended to help facilitate on-boarding of developers that are new to the application. As the application evolves, so will this document. PRs with updates and improvements are welcome!!
This document provides a general overview of the key parts of the Abalone Analytics application. It is primarily intended to help facilitate on-boarding of developers that are new to the application. As the application evolves, so will this document. PRs with updates and improvements are welcome!

## Purpose

Expand All @@ -18,7 +18,7 @@ The application also accepts direct imports for several models in the system. Th

### Data Storage

Imported data is currently stored in the database and presented using a combination of standard rails views (Animals index, Cohorts index, etc.) and the reporting interface described below. We expect the storage and presentation of data to evolve to suit the needs of the application's initial stakeholders.
Imported data is stored in the database and presented using a combination of standard rails views (Animals index, Cohorts index, etc.) and the reporting interface described below. We expect the storage and presentation of data to evolve to suit the needs of the application's initial stakeholders.

### Reporting

Expand All @@ -37,7 +37,7 @@ Currently, an organization's users can have one of two roles - `admin` and `user

#### Row level security

The application makes use of row level security to protect each organizations data in the reporting interface. The technical process for applying and updating the row level security can be found [here](https://github.com/rubyforgood/abalone/blob/main/blazer_reporting.md). The application has a rake task in place that handles the SQL commands needed. This task is updated when new tables that should be included in row level security or made available to an org_user are added.
The application makes use of row level security to protect each organizations data in the reporting interface. The technical process for applying and updating the row level security can be found [here](https://github.com/rubyforgood/abalone/blob/main/blazer_reporting.md). The application has a rake task that handles the SQL commands needed. This task is updated when new tables that should be included in row level security or made available to an org_user are added.

#### Other models

Expand All @@ -52,21 +52,23 @@ Currently, the following models access the `organization` model directly. This i
operations
facilities
animals
processed_files
```

### Data Import

There are two primary paths for importing data into the system.

The first is through the File Upload interface. This allows users to import csv files containing measurement data. Organizations can enter custom measurement types, for example, `mm`, `count`, `gonad_score`. In the future, additional categories beyond `measurement` could be added to this interface. Organizations can upload existing files or download a template file that they can populate.
The first is through the File Upload interface. This allows users to import csv files containing measurement event data or mortality event date. Organizations can enter custom measurement types, for example, `mm`, `count`, `gonad_score` and custom exit types, for example, `incidental`, `olutplanted`, `sacrificed`. In the future, additional categories beyond `measurement` and `mortalityEvent` could be added to this interface. Organizations can upload existing files or download a template file that they can populate.

Application Flow:
- Files uploaded at FileUploads#new
- Upload is sent to [FileUploder](https://github.com/rubyforgood/abalone/blob/main/app/lib/file_uploader.rb)
- If the category is valid, a background job is created to process the files
- The job for the relevant `UPLOADABLE_MODEL` is run. This job will include `ImportJob`
- [ImportJob](https://github.com/rubyforgood/abalone/blob/main/app/jobs/concerns/import_job.rb) runs
- The job is performed, validating headers against the model and calling `import_records`
- The import information is passed to [CSVImporter.new](https://github.com/rubyforgood/abalone/blob/main/app/lib/csv_importer.rb) to create the measurement record from the import.
- The job is performed, validating headers and calling `import_records`
- The import information is passed to [CSVImporter.new](https://github.com/rubyforgood/abalone/blob/main/app/lib/csv_importer.rb) to create the record from the import.

The second is through the CSV Upload path available on certain index pages. These allow users to import model specific csv files such as a file of basic animal data. These are most likely to be used when onboarding an organization.

Expand Down
14 changes: 7 additions & 7 deletions blazer_reporting.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Abalone Analytics Blazer Reporting

This application utilizes a modified implementation of the [Blazer](https://github.com/ankane/blazer) gem to provide direct SQL access to specific tables with data scoped to an organizational level. Modifications to the Blazer gem are performed in app/overrides directories per [Rails documented practices](https://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers). The Blazer gem version has been locked at 2.4.7 to ensure these overrides remain dependable.
This application utilizes a modified implementation of the [Blazer](https://github.com/ankane/blazer) gem to provide direct SQL access to specific tables with data scoped to an organizational level. Modifications to the Blazer gem are performed in app/overrides directories per [Rails documented practices](https://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers). The Blazer gem version has been locked at 2.5.0 to ensure these overrides remain dependable.

Use of the Blazer gem requires setup in both the production and development environments.

### Production Environment

#### Initial Setup

This setup assumes Heroku hosting. Guidance for setup on other hosting platforms is welcome via PR. The maintainers will also update this document as the application evolves.
This setup assumes Heroku hosting. Guidance for setup on other hosting platforms is welcome via pull request. The maintainers will also update this document as the application evolves.

Note: Requires, at least, a Standard-0 Postgres instance in Heroku to allow for the creation of additional roles.

Expand All @@ -27,10 +27,10 @@ Note: For consistency, each org credential should be named with that organizatio
6. Attach that credential to the application.
7. Leave the permissions blank. They will be set by the Blazer rake task.
8. Repeat steps 5-7 for each organization in the application.
9. In Heroku, add the environment variables for the blazer credential and all org credentials. The urls will be available under each credential in the Postgres add-on.
`BLAZER_DATABASE_URL: add credential uri here`
`ORG1_DATABASE_URL: add credential uri here`
`ORG2_DATABASE_URL: add credential uri here`
9. In Heroku, add the environment variables for the blazer credential and all org credentials. The urls will be available under each credential in the Postgres add-on.
`BLAZER_DATABASE_URL: add credential uri here`
`ORG1_DATABASE_URL: add credential uri here`
`ORG2_DATABASE_URL: add credential uri here`
10. Run a backup of the production database
11. Run the Blazer rake task: `heroku run SAVE=1 rake blazer:add_database_security`.
12. Log in as an organization user and confirm reporting is now functioning and scoped.
Expand Down Expand Up @@ -84,7 +84,7 @@ This process assumes initial setup, migration and seeding of a local postgres da
### Refreshing the staging database

- Run manual backup of the database
- Confirm that we have a backup of each SQL query. (these will need to be re-entered)
- Confirm that we have a backup of each SQL query (these will need to be re-entered).
- Reset the database through the Heroku interface
- `heroku run rails db:migrate --app abalone-staging`
- `heroku run rails db:seed --app abalone-staging`
Expand Down

0 comments on commit 2becd12

Please sign in to comment.