Skip to content

Admin & Data Management

Susan Paykin edited this page Jun 14, 2022 · 2 revisions

Admin & Data Management

A guide to updating and managing the OEPS Data Warehouse & Explorer App.

Quickstart

  1. Make sure to install Github or Git, and Nodejs
  2. After installing node, install yarn using npm i -g yarn
  3. Clone this repository to your computer using git clone https://github.com/GeoDaCenter/opioid-policy-scan.git
  4. In your terminal from this directory, run yarn. This will install the packages needed to use this repository
  5. Again in your terminal, run yarn dev to begin development. Your terminal will give you a local website URL to view the development version of the site. Usually, this is localhost:3000. Enter this in your browser to see the site.
  6. Open your code editor of choice like Visual Studio Code and begin making changes.
  7. When you are happy with your edits, commit and push your changes to Github. This will trigger the deploy process and your changes should go live momentarily.

Updating GitHub - Data Warehouse

  1. If you’re adding a new dataset or updating an existing database, follow the instructions and data standards outlined in the OEPS Wiki for open source contributions.
  2. If someone else has added data, review their pull request contribution for accuracy and consistency. When it’s ready, merge in their changes, and go to the next step.
  3. Update the main Data Overview table in the README file with the new dataset/variable information, following the existing table and variable construct format.
  4. Check, comment, or close any issues related to that dataset.

Updating OEPS Explorer Site

Make sure you’re working in the explorer branch of the repo to make edits or updates to the OEPS Explorer Site.

Adding New Data

  1. Copy and add the new data csv files to the public/csv folder
  2. Save your changes.

Updating Data Docs

  1. In the explorer branch, open the file meta/variables.js
  2. Navigate to the correct theme, such as Policy Variables, Demographic Variables, etc.
  3. Copy the 10-line code chunk template:
data docs update code
  1. Paste it below in the order you want it to appear in the Docs page. Delete the previously populated information and fill in the new information for your new dataset (i.e. Variable Proxy, Source, Metadata, markdownText, etc.
  2. Save your changes.

Updating the Map

  1. In the explorer branch, open the file map-config.js
  2. Add your data to the corresponding geography, starting at line 6: const data = [.
map data code template
  • The options are ‘US States’, ‘US Counties’, ‘US Zip Codes’, and ‘US Tracts’. Add your data to the correct geographies. For example, if you have PS09_S.csv and PS09_C.csv, you will add PS09: { } to the US states and US counties geographies section.
  • Fill in file: ‘’ , type: ‘characteristics’, and join: ‘’.
  • Make sure you are using the correct join variable (states = STATEFP, counties = COUNTYFP, zip codes = ZCTA, tracts = GEOID). Make sure this is also labeled correctly in your csv data file. This facilitates the merge with spatial geometries for mapping.
  1. Next, open the file config/variables.csv with your preferred text editor, such as Excel, Numbers, or Visual Studio Code.

  2. Edit this csv file to add new variables to the map:

  • Variable name
  • Theme
  • Subtheme (optional)
  • data table
  • data column (variable name in .csv)
  • categorical (optional; TRUE or FALSE; default = FALSE)
  • fixed binning scale (optional; set fixed binning, default = FALSE)
  • Binning strategy (naturalBreaks, quantileBreaks, custom)
  • Number of bins
  • Color scale (colorbrewer)
  • Reverse color scale (optional; default = FALSE)
  1. Save your changes.