healthyregions / chicago-environment-explorer

ChiVes harmonizes & standardizes environmental data across dozens of sources to make it accessible for full exploration, alongside a growing list of resources on the Chicago Environment, cultivated by a community of curators.
8 stars 1 forks source link

feat: Hide inactive variables, include TXT instructions with CSV download (as ZIP) #135

Closed bodom0015 closed 7 months ago

bodom0015 commented 7 months ago

Problem

  1. It would be nice to show users who download the CSV from the Index Builder how the numerical data was derived
  2. Some variables may need to be temporarily disabled without removing them from the Google Sheet

Approach

  1. Include customized TXT instructions (with selected indicators + weights) with CSV, download both files as ZIP to avoid browser security warnings (e.g. "This site is trying to download multiple files")
  2. Added a new column to the Data Dictionary and Variables sheet: active
    • if TRUE, show this variable on the /map and other views in the UI
    • if FALSE, skip parsing this variable and disable it from affecting any of the views in the frontend application
    • Set active for all variables to TRUE, except for Observed PM2.5 which should be disabled

How to Test

ZIP Download "Download > CSV" now downloads a ZIP file containing the CSV alongside a TXT explanation

  1. Navigate to https://deploy-preview-135--chicago-env-explorer.netlify.app/builder
  2. Choose one or more Indicators (e.g. Surface Temperature + Child Asthma Rate) and click Next at the bottom-right
  3. Assign weights to each indicator and click Next at the bottom-right
  4. On the "Summary & Map" view, expand the Download dropdown at the bottom-left and pick CSV
    • You should see a download start for a file named chives-custom-index.zip
  5. After the download completes, open the ZIP file
    • You should see that the zip file contains chives-custom-index.csv and README.txt
  6. Open the CSV file
    • You should see all numerical data associated with computing this custom index
  7. Open the TXT file
    • You should see an explanation of how this Custom Index data was computed

Active/Inactive Variables Observed Particulate Matter (PM2.5) has been marked as inactive, and should not appear in the frontend at all

  1. Navigate to https://deploy-preview-135--chicago-env-explorer.netlify.app/map
  2. Expand the Variables dropdown
    • You should see that "Observed Particulate Matter (PM2.5)" is no longer listed under "Air Pollution"
  3. Navigate to https://deploy-preview-135--chicago-env-explorer.netlify.app/builder
    • You should see that "Observed Particulate Matter (PM2.5)" is no longer listed under "Air Pollution"
  4. Navigate to https://deploy-preview-135--chicago-env-explorer.netlify.app/data
    • You should see that "Observed Particulate Matter (PM2.5)" is no longer listed under "Map Variables and Data Sources"
netlify[bot] commented 7 months ago

Deploy Preview for chicago-env-explorer ready!

Name Link
Latest commit 5dda5ffa57efbeb8c15af3e53549a6171e97d8bc
Latest deploy log https://app.netlify.com/sites/chicago-env-explorer/deploys/65e89fc5f04dbf0008135829
Deploy Preview https://deploy-preview-135--chicago-env-explorer.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mradamcox commented 7 months ago

Also, the explanation in the zip readme is great, we should ultimately pull that into the interface somewhere as well.

bodom0015 commented 7 months ago

Thank you, @mradamcox! I've updated this PR to read the DEBUG variable from .env as REACT_APP_DEBUG

Truthy values: t, T, true, TRUE, etc If value is missing or if any value does not contain t (case insensitive), then it is considered false

And we can ask @shubhamk008 if there is a good place to include the contents of that TXT file that explain how the Custom Index is built :+1: