/envelope

Primary LanguagePythonMIT LicenseMIT

Envelope - non-profit data processing, visualizations, and multi-location mapping

Envelope is a full-stack application for non-profits to analyze large datasets & build reporting for external partners that feature interactive mapping & beautiful visualizations.

Check it out

Wanna see it in action? Click here & use the demo login button

Technologies

Font End
CSS React Redux React Router Mapbox
Back End
Flask Python Pandas NumPy PostgreSQL
Deployment and Package Management
Heroku Docker git npm

Usage

Development

Want to contribute?

To fix a bug or add a feature, follow these steps:

  • Fork the repository
  • Create a new branch with git checkout -b feature-branch-name
  • Make appropriate changes to the files and push back to github
  • Create a Pull Request
    • Use a clear and descriptive title for the issue to identify the suggestion.
    • Include any relevant issue numbers in the PR body, not the title.
    • Provide a comprehensive description of all changes made.

Setting Up and Starting a Local Server

  1. Clone this repository (only this branch)

    git clone https://github.com/nappernick/envelope.git
  2. Install dependencies

    pipenv install --dev -r dev-requirements.txt && pipenv install -r requirements.txt
  3. Create a .env file based on the example with proper settings for your development environment

  4. Setup your PostgreSQL user, password and database and make sure it matches your .env file

  5. Get into your pipenv, migrate your database, seed your database, and run your flask app

    pipenv shell
    flask db upgrade
    flask seed all
    flask run
  6. To run the React App in development, in a separate terminal:

    cd client
    
    npm install
    
    npm start
    

IMPORTANT! If you add any python dependencies to your pipfiles, you'll need to regenerate your requirements.txt before deployment. You can do this by running:

pipenv lock -r > requirements.txt

ALSO IMPORTANT! psycopg2-binary MUST remain a dev dependency because you can't install it on apline-linux. There is a layer in the Dockerfile that will install psycopg2 (not binary) for us.


Deployment to Heroku

  1. Create a new project on Heroku

  2. Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres"

  3. Install the Heroku CLI

  4. Run

    heroku login
  5. Login to the heroku container registry

    heroku container:login
  6. Update the REACT_APP_BASE_URL variable in the Dockerfile. This should be the full URL of your Heroku app: i.e. "https://flask-react-aa.herokuapp.com"

  7. Push your docker container to heroku from the root directory of your project. This will build the dockerfile and push the image to your heroku container registry

    heroku container:push web -a {NAME_OF_HEROKU_APP}
  8. Release your docker container to heroku

    heroku container:release web -a {NAME_OF_HEROKU_APP}
  9. set up your database:

    heroku run -a {NAME_OF_HEROKU_APP} flask db upgrade
    heroku run -a {NAME_OF_HEROKU_APP} flask seed all
  10. Under Settings find "Config Vars" and add any additional/secret .env variables.

Bug / Feature Request

We love squashing bugs! If you find one, let our exterminators know by opening an issue here. Be sure to be clear in the description of the bug (i.e. what was input into the field that caused the bug). Screenshots or recordings greatly help!

If you'd like to request a new feature open up an issue here. This project was created as part of App Academy's coursework, but we love dreaming up of ways to improve our work.

Built By

Nick Matthews

V2

Admin Tools:

  • Users view:
    • A left hand column of current projects (which represent datasets & their reports) which can be dragged onto a user, giving that user access

Reporting:

  • 2 box plots (would like to implement violin plots instead if possible), one menage of box plots (a chart of box plots with surveyor on x axis), one bar chart per section below (this is recreating what is currently sent out to clients). Should need to create a component for each, then just change input data.
    1. Interview duration
    2. "Don't know" responses
    3. Integer outlier data points
    4. Average distance (only histogram)
    5. Distance outliers (only 1 box plot, otherwise the same)
  • For each project (which will have a set of surveys completed) show a map of the survey area (denoted with a circle) with:
    • the routes of each surveyor
    • a link to view a table of the outlier/don't know rows with a checkbox to say "plausible" (stretch)
    • if the survey is a panel (meaning surveying the same family multiple times over the course of years), the distance of that current survey from the last survey of that family (stretch)
    • Ability to export that as a KML file (stretch)
  • Report by surveyor showing their trend, since they began surveying, for number of don't knows/outlier data points, y axis showing the number of "issue" data points, and a point on the graph for every survey they've taken (stretch)
  • Make outlier data points in box plots clickable, to open a report view for that specific outlier (stretch)

CRUD

  • A low bandwidth form to allow LB users to login & view sets of data that need to be updated, then update those values (could also generate a csv & allowing the user to download it, edit, and upload it once complete - offline is huge in Sudan) (will only implement either form or csv, other will be stretch)
  • Once completed by LB user, update the admin user with very simple notification email or in app notification (stretch)
  • for those fields where correct data was retrieved, update the data set automatically (alt. could have admin user view & approve those updates) with new data. Where data could not be found, add a note to the survey compilation/summary with surveyor number, respondent name, and field where data could not be gotten.
  • Once performed, update the client user with a notification (email or in app) that their reports have been updated (stretch)