Giter Site home page Giter Site logo

city-bureau / chi-covid-resources Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 1.61 MB

Find resources in the Chicago area during the coronavirus pandemic

Home Page: https://covid.citybureau.org/

License: MIT License

Makefile 0.96% JavaScript 81.28% Python 2.35% SCSS 15.42%
coronavirus covid-19 gatsby chicago airtable

chi-covid-resources's Introduction

Chicago COVID Resource Finder

Build status

Find updated, verified information on resources in the Chicago area during the coronavirus pandemic. Maintained by City Bureau.

Setup

You'll need Node installed and an Airtable account set up with the fields in src/pages/index.js.

The quickest and easiest way to make sure you have the fields required is to:

  1. Clone this repository to a location of your choosing: git clone https://github.com/City-Bureau/chi-covid-resources.git

  2. Make a copy of this Airtable COVID Resource Finder base template.

  3. Copy the .env.sample to .env and fill in the values with your Airtable API key and information about your base. The minimum requirements to build the site correctly are values for AIRTABLE_BASE, AIRTABLE_KEY, and AIRTABLE_TABLE. You can also provide a value for the view, like so:

    AIRTABLE_BASE="appkz5EStpFHaq9jv"
    AIRTABLE_KEY="yourairtableapikey"
    AIRTABLE_TABLE="Directory"
    AIRTABLE_VIEW="Approved"
    REPORT_ERROR_PATH=
    

    Fetching and populating this data relies on the gatsby-source-airtable.

  4. To make sure that form submissions will work correctly,replace the form-id keys in src/intl/ with the Airtable IDs of your forms. You can find the form ID at the end of the URL displayed in the "Share form" control of your form view https://airtable.com/{FORM_ID}.

  5. Once you've set up the prerequisites, you can install dependencies and start a server at localhost:8000 with:

    npm install
    npm start

Reporting Resource Errors

If you want to use the functionality for reporting errors with resources, you'll need to deploy an AWS Lambda function using the serverless-airtable-button repo. Alternatively you can replace the custom form modal with an Airtable embed using the AirtableEmbedModal component and setting the prefill_Resource param in the queryParams property to prefill the flagged resource.

Internationalization

Multilingual support is provided through gatsby-plugin-intl. Translated phrases are located in JSON files in the src/intl/ directory, and translated Markdown pages are in src/markdown/static.

Some of the content is specific to City Bureau, but the majority of the translated phrases are not. You can configure which languages are displayed by modifying the languages array in gatsby-config.js.

The Python script scripts/load_i18n.py is used to load translated content directly from a publicly viewable Google Sheet with this structure:

ID English Spanish
home Home Inicio
about About Acerca de

To load the Spanish column's translations for all of the keys in the KEYS list, you'll need to set the SPREADSHEET_ID environment variable to the Google Sheet ID (found in the URL) and run:

make src/intl/i18n.csv
cat src/intl/i18n.csv | python scripts/load_i18n.py Spanish > src/intl/es.json

You can replace "Spanish" in the command with the column name that has completed translations.

ZIP Code Search

To avoid the overhead and additional network requests of a geocoder, we're using a pre-generated mapping of ZIP codes to other ZIP codes they overlap to do a fuzzy ZIP search. You can update the mapping for your area by using our repo City-Bureau/nearby-zip-map to create a new file and replace the one in src/data/zip-map.json.

Some of our resources are specific to the city of Chicago while others are available to the surrounding region. To make sure users searching ZIP codes outside of Chicago don't see Chicago resources, we're using a static list of city ZIP codes to determine whether resources are displayed when a ZIP code is searched. To replicate this for your area you can update the file src/data/city-zips.json.

Deploy

To deploy the AWS S3 and Cloudfront, create an S3 bucket that allows static site hosting and a Cloudfront distribution pointing to the bucket's web hosting endpoint. Set the S3_BUCKET and CLOUDFRONT_ID environment variables with your bucket and distribution ID, and then with GNU Make and the AWS CLI installed run make deploy.

Acknowledgments

We thank the input of our community partners including Chicago United for Equity, Rohingya Cultural Center, West Side United, Organized Communities Against Deportations, The Middle Eastern Immigrant and Refugee Alliance (MIRA), Austin Coming Together, The Goodie Shop and The Firehouse Community Arts Center. Resources were compiled from original research by City Bureau’s editorial team and thanks to the existing lists created by the City of Chicago, Block Club Chicago, South Side Weekly, West Side United, Accion and ICIRR.

The setup for this project is directly inspired by the Education Justice Project's Illinois Reentry Resources, which is a fork of DataMade's Cook County Probation Community Resources.

🧐 What's inside?

A quick look at the top-level files and directories you'll see in this Gatsby project.

.
β”œβ”€β”€ node_modules
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
β”œβ”€β”€ gatsby-node.js
β”œβ”€β”€ LICENSE
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md
  1. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  2. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  3. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  4. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

  5. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  6. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  7. LICENSE: Gatsby is licensed under the MIT license.

  8. package-lock.json (See package.json below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won’t change this file directly).

  9. package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.

  10. README.md: A text file containing useful reference information about your project.

πŸŽ“ Learning Gatsby

Looking for more guidance? Full documentation for Gatsby lives on the website. Here are some places to start:

  • For most developers, we recommend starting with our in-depth tutorial for creating a site with Gatsby. It starts with zero assumptions about your level of ability and walks through every step of the process.

  • To dive straight into code samples, head to our documentation. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.

chi-covid-resources's People

Contributors

easherma avatar pjsier avatar rajivsinclair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chi-covid-resources's Issues

Is google sheet referenced in Makefile still required for this project?

This env value doesn't appear to be referenced anywhere else?

wget -O $@ 'https://docs.google.com/spreadsheets/d/${SPREADSHEET_ID}/export?format=csv&id=${SPREADSHEET_ID}&gid=0'

On the subject of the Makefile, any particular reason why the project uses npm but the deploy process uses yarn? Would it be useful to simplify it to use npm for both? (I reckon this may be a holdover from when npm was much worse at locking dependencies, etc)

It also appears the Makefile relies on the aws CLI, which is a dependency not currently documented

Actually the more I think about it and look at the Makefile, we could probably get rid of it and replace it with a command inside the package.json that uses the deploy command with the config variables used via npmrc or something similar.

Look into Open Referral spec for resources

Open Referral is designed for exactly this use case, and with some more time it could be worth supporting for the Airtable backend. There are a few examples of Airtable templates based on the spec which should be useful for looking at migration. It could also be worth looking into whether we can have a hybrid setup where data is entered in a more simple format and then split out into the spec components with a script

Things to consider:

  • What does migration look like?
  • How much complexity is added?
  • What information would we not be able to represent?
    • Does it include any kind of "extra" fields for information not directly supported?

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.