Skip to content

ajanian/ca_visit_tracking

 
 

Repository files navigation

Hello!

If you are a crisis response team who needs help working with this data — please contact support@visitdata.org.

VisitData.org needs volunteer programmers, data analysts, and crisis team liaisons — please contact volunteers@visitdata.org or visit https://github.com/VisitData-org/ca_visit_tracking.

More FAQs here: https://visitdata.org/faq

Running locally

To run the app locally, in development mode:

  1. Obtain a Google Maps API key. If you do not have one, you can just set it to "" and the map will be disabled. Note the API key should never be committed to the git repository.
  2. Set up a Python virtualenv, as specified below.
  3. Run the server, as specified below.
  4. Use Chrome or Firefox as your browser - it is reported that Safari reports a CORS error in development.

Set up a Python environment

To set up a virtual env:

$ python3 -m venv ~/myenv
$ source ~/myenv/bin/activate
$ pip install -r requirements.txt

Run server in development mode:

To run the server in development mode:

$ export MAPS_API_KEY="..."
$ gcloud auth application-default login
$ make run

The development server will automatically refresh when files change.

Accessing the data

Data has moved out of the repository and into Google Cloud Storage in a public bucket. You can access the latest data at https://visitdata.org/data/

Accessing from the bucket directly

  1. Install the Google Cloud SDK
  2. Run:
    gsutil ls gs://data.visitdata.org
    

Accessing via http

The latest data snapshot is hosted on https://visitdata.org/data/

Historic data snapshots are also hosted on https://data.visitdata.org/

For example, you can retrieve https://data.visitdata.org/processed/vendor/foursquare/asof/20200403-v0/taxonomy.json

Importing new data

To import new data:

  1. Copy yesterday's data

    $ gsutil -m cp -r gs://data.visitdata.org/processed/vendor/foursquare/asof/20200402-v0 /tmp
  2. Process the new day's data by pointing to the previous day's data, the new download file and the name of the build directory to be created by the script.

    $ bin/foursquare_extract.sh /tmp/20200402-v0 ~/Downloads/apr-3 /tmp/build
  3. Load the processed data to the bucket

    $ bin/foursquare_load.sh /tmp/build 20200403-v0 
  4. Modify app.yaml to point to the new data version

    $ vi app.yaml
    ...
    env_variables:
      FOURSQUARE_DATA_VERSION: "20200403-v0"

Deploying to the web server

To deploy the app to visitdata.org:

Setting up Google Cloud SDK for AppEngine

  1. Install the latest gcloud SDK: https://cloud.google.com/sdk/docs

  2. Login using a Google account:

    $ gcloud auth login
  3. Set the default project:

    $ gcloud config set project os-covid

To deploy the app to beta.visitdata.org:

Run:

$ cd .../ca_visit_tracking
$ make deploy-beta

To deploy the app to visitdata.org (production):

Run:

$ cd .../ca_visit_tracking
$ make deploy-prod

Data ETL via Airflow

Extract, Transform and Load (ETL) Airflow operators and DAGs in this repository under etl/. These can be run locally or on the production server.

See the etl/README.md for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.2%
  • HTML 14.0%
  • Python 6.9%
  • Shell 2.0%
  • Other 0.9%