Giter Site home page Giter Site logo

rubyforgood / flaredown Goto Github PK

View Code? Open in Web Editor NEW
38.0 10.0 13.0 17.48 MB

Flaredown web app and API

Home Page: http://www.flaredown.com

License: GNU General Public License v3.0

Ruby 53.34% HTML 0.90% JavaScript 29.50% SCSS 4.22% Handlebars 10.28% Procfile 0.01% Dockerfile 0.17% Shell 0.03% TypeScript 1.47% Makefile 0.07%
health chronic-illness ember emberjs rails mhealth hacktoberfest hacktoberfest2021 ruby mongodb

flaredown's Introduction

Flaredown

rspec frontend ERB lint standardrb lint

Flaredown makes it easy for people to track symptoms over time, and learn how to control them. Our goal is to analyze the aggregate data from users of this tool to understand the probable effects of treatments and environmental stressors on chronic illness.

Help would be appreciated! Please join us in slack #flaredown, raise a GitHub issue, or email contact@flaredown.

Environment

  • PostgreSQL 12.8
  • MongoDB 4.4.9
  • Redis 6.2.3
  • Ruby 3.2.3
  • Node 12.22.6

Installation

The application and all dependencies are dockerized and can be run using docker compose, so there's no dependencies to install other than Docker. Alternatively, you can run the app using the make commands available: make help

If you want to run the application on your own machine see the next sections on dependency installations

Running natively

Mac Prerequisites

If you are running on an M1 mac, run the following command before you start the installation process:

$env /usr/bin/arch -arm64 /bin/zsh ---login

Remove all gems before you proceed

gem uninstall -aIx

Backend

You can install the dependencies via asdf-vm declared in the .tool-versions file, or:

On macOS, you can install libpq by running brew install libpq && brew link --force libpq && bundle config --local build.pg "--with-ldflags=-L$(brew --prefix libpq)/lib --with-pg-include=$(brew --prefix libpq)/include", which is required for bundle install to succeed.

cd backend
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
bundle config set --local without 'production'
bundle config set --local jobs 5
bundle config set --local retry 10
bundle install
cp env-example .env # You may adjust it however you like
                    # RVM is going to autoload this on every 'cd' to the directory
bundle exec rake app:setup

gem install foreman

Frontend

cd frontend
npm install

React Native

cd native
npm install

Development

Prerequisites

  • Populate the necessary environment parameters with cp backend/env-example backend/.env && cp backend/env-example frontend/.env
  • Create a Facebook dev app and paste your own ID into frontend/.env file's FACEBOOK_APP_ID parameter.
    • Note: This is not necessary in backend/.env but we have not yet cleaned up these two files into the necessary components.
  • Seed your database using make seed or bundle exec rails app:setup

Running

If you are running the application natively, run the following to start your server. If you're using docker, this should be up and running already.

rake run

Visit your app at http://localhost:4300 for the current ember application, or http://localhost:19006 for the React Native version.

Running tests locally

  1. Run make build or docker compose build backend to ensure the latest backend is built and being run
  2. To run all tests run make specs or script/backend rspec spec spec, or you can run a specific test suite such as script/backend rspec spec spec/services/weather_retriever_spec.rb
  3. Debugging tip: in Ruby code you can add a line that says debugger and rspec will automatically break on that line and give you an interactive Ruby shell

CI

Several checks are configured to run on all commits using GitHub Actions, including lint, build and test steps. Definitions can be found in ./.github/workflows. Those checks which always run are required to be successful for pull requests to be merged.

Deployment

Deployments target Heroku. The traditional deployment is manually configured and is composed of two distinct applications (frontend and api) in two environments (staging and production), with automatic deployments to staging of commits to master:

Addons are used for Heroku Postgres, Heroku Redis, Heroku Scheduler + Papertrail. MongoDB is provided by mongodb.com.

Style Guide

🎨 Figma Assets

Common Problems

  • On first load, the app displays a blank beige screen instead of the login screen. Temporary fix is to add console.log(process.env.FACEBOOK_APP_ID) right inside of the module.exports at the top of the frontend/config/environment.js file. You can then refresh the page (no need to kill Docker) and this should fix it. You can now remove the log.

License

Copyright 2015-2024 Logan Merriam and contributors.

Flaredown is open source software made available under the GPLv3 License. For details see the LICENSE file.

flaredown's People

Contributors

algodave avatar alysonbasilio avatar atinybeardedman avatar batistadev1113 avatar benlangfeld avatar bglusman avatar bklang avatar codemonium avatar compwron avatar cwille97 avatar dependabot[bot] avatar esquith avatar freestylebit avatar haydenrou avatar hussam-i-am avatar jasperfurniss avatar joekarow avatar johnpaulashenfelter avatar kre8sions avatar lmerriam avatar mansona avatar mpugach avatar safeforge avatar samanthar8 avatar seanmarcia avatar solebared avatar tonkpils avatar x-tina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flaredown's Issues

Pips stuck on hover

If you leave a summary screen open for a few minutes, it can get into a state where the first hover over a pip locks the rating in. Even clicking and changing the rating will not reset it.

If you refresh the page, it functions fine and you will see that any rating changes you made did register.

Video: https://www.dropbox.com/s/ff47v1ulcqteinx/pipBug.mov?dl=0

Line graphs should connect across empty days

Example: I record a rating for the Abdominal Pain symptom on Wednesday, I don't record one on Thursday, and I do record one on Friday.

Right now the line graph does not draw a line between Wednesday and Friday because Thursday had no value. We should connect the line graph across days, and add dots to show which days were explicitly rated. Quick example:

screenshot 2016-02-24 17 27 08

Do not create entry until user has entered data

If the user is just navigating through days by clicking the back arrow, we don't want to create an entry for each one (and thus turn them into empty summaries) until they actually enter data to be saved.

Graph lines interpolation

Currently, on days when the user does not rate a trackable, the graph returns to a midpoint. What it should do is interpolate between the points directly:

group 3

[Airbrake] message: Validation of Checkin failed. summary: The following errors were found: Date is already taken resolution: Try persisting the document with valid data or remove the validations.

Airbrake error: #3994
Airbrake project: Flaredown

Error type: Mongoid::Errors::Validations
Error message: message: Validation of Checkin failed. summary: The following errors were found: Date is already taken resolution: Try persisting the document with valid data or remove the validations.
Where: checkins#create
Occurred at: Apr 01, 2016 12:42:42 UTC
First seen at: Mar 26, 2016 01:22:44 UTC
Occurrences: 177 (0 since last deploy on <no information>)

URL: https://flaredown-api.herokuapp.com/api/checkins
File: /gems/mongoid-5.0.2/lib/mongoid/persistable.rb

Backtrace:

/gems/mongoid-5.0.2/lib/mongoid/persistable.rb:78:in fail_due_to_validation!
/gems/mongoid-5.0.2/lib/mongoid/persistable/updatable.rb:73:in update!
/app/app/services/checkin_creator.rb:28:in create!
/app/app/controllers/api/v1/checkins_controller.rb:13:in create

Improved history navigation

Navigating the chart on touch devices is particularly tough, because scrolling up and down to see different trackables conflicts with the left/right dragging gesture to navigate the chart viewport. The goal is to improve navigation patterns.

screenshot 2016-12-22 12 56 05

  • Navigation buttons that move the chart backwards and forwards in time
  • Calendar button that opens a datepicker (mockup uses a screenshot of the PickADate.js plugin). On selecting a date the chart viewport should be centered on that date.
  • Tap anywhere on the charts to show the scrubber, along with a button displaying the date. Tap on the scrubber again to hide it. Tap the button to navigate to the check-in for that date. (extracted to #162)

After some experimenting, it looks like a good date range for mobile portrait is around 10 days. Maybe we can check the user's window width when the page is loaded up and adjust the amount of days in the view such that they are spaced ~32 pixels apart.

Default route

If the user has already checked-in today, default route when they open the app should be the charts
If the user has no entry today, default route should be today's check-in

Hide and show trackables on history

For simplicity, the first version of the history showed all trackables by default. That means it's tough for users to compare the specific trackables they're interested in (for example, if I want to see the effects of a particular treatment on a symptom, and they are not both visible on the screen). To fix this, let's give users control over the visible trackables.

screenshot 2016-12-22 14 46 59

  • Button in the history navbar that lists the number of visible trackables, which you can tap on to open the trackable selector modal.
  • Dropdown in the modal to select different trackable types. As we are adding new types of trackables, we should try to make sure that new ones in the future show up in this list.
  • List trackables of the currently selected type, with a switch to turn them on/off in the history

Loading icon

We should throw in a spinner when the graph is loading up, otherwise it's just a blank page for several seconds

Graph lines are reversed

The line graphs are currently low when the user has indicated MORE active ratings in the check-in, and high when the user has indicated that a condition/symptom is less active (which is backwards). See here:

image

image

More pips selected by user should = higher line graph

Failed tracking new condition typed

On today's checkin, when typing a new condition not present in select box, I get the following failure:

POST http://localhost:4300/api/trackings 422

That's because trackable_id and trackable_type params are sent as null values.

Cache the history

Right now, if the user leaves the history to navigate to another section of the app, then returns to the history, they have to load the history again. If possible, it would be ideal to cache the currently visible history when the graph loads, so that the user can quickly switch between sections of the app.

Trackable color different from chart to checkin

@safeforge found a case when trackable color differs from chart to checkin.
Not sure if this is an edge case, @lmerriam might help understanding this.

  1. User adds a trackable to a past day's checkin; system assigns it a random color and saves it into checkin record. As per req., it won't be tracked on future days, and it won't appear in the chart either.
  2. User adds the same trackable to today's checkin. As per req., it will be tracked on future days, so system assigns it a random color which gets saved in the tracking record.

Now that trackable appears on chart, but on that past day's checkin from step 1 it continues to appear with its original color, because at that date no tracking record exists for that trackable.

coding_addiction

screen shot 2016-02-26 at 19 24 03

Color of trackable too close to default gray color

The gray color of a trackable item is too close to the default color and could be mistaken for the items not being clickable/working. I actually thought something was wrong with the Back Pain trackable and it wasn't clickable when I first noticed it. See screen shot.

http://prntscr.com/amthgn

Consider either darkening the gray or not using a color so close to the default color.

Change email form

Give the user a way to change the email address they log in with and receive emails from Flaredown at

Error monitoring

Let's choose and implement a service to monitor exceptions in the production app

SSO with Discourse

Our existing app creates an account for our users on our discourse and logs them into it, let's get that working in flaredownember-2

Integrate intercom

Send the same information as the existing app:

  • Demographic and profile data
  • Check-in event
  • Onboarded event

Create a new "app" on intercom so stats are kept separate from the old app.

Autosuggest improvements

1. A new trackable should only become visible in the autosuggest if 5 people independently add it, to make sure that we don't end up with a bunch of variations of the same thing. DONE

  1. We should show the number of users like the existing app does:
    screenshot 2016-02-24 14 22 59

Checkin Summary: new trackables added appear twice, page refresh fixes

When adding a new Condition, Symptom or Treatment from the Checkin Summary screen, it appears twice immediately after autosave. Refreshing the page shows it once as expected.
@lmerriam adding this to Launch milestone, feel free to change if disagree.

Developer note: this happens because the onCheckinSaved() method from trackables-step component needs to be invoked, rather than the generic one coming from the CheckinAutosave mixin, so that the deleteAddedTrackeds() method is invoked, which removes 'ghost' records

Date issues

Two issues I can reproduce:

  • Clicking on a date on the graph takes me to the prior day in the check-in
  • Clicking the arrow to move to the previous day in the check-in moves me back two days, clicking the arrow to move to the next day in the check-in does not do anything

List Popular Tags

checkin-tags_popular

This feature is present in the old app, so I'm adding it to Launch milestone.
@lmerriam Feel free to change if you disagree.

Given URL is not allowed by the Application configuration

Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

screen shot 2016-03-30 at 00 21 59

Endless loading

Users report seeing the loading dots endlessly

Seeing lots of timeouts on the heroku dashboard:
screenshot 2016-03-31 10 26 47

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.