GithubHelp home page GithubHelp logo

fabriziomiano / barchartrace2mongo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 52 KB

COVID-19 bar chart race HTML production to mongo DB

Python 98.65% Shell 1.35%
barchartrace mongo bar-chart-race covidashit covid-19 dashboard

barchartrace2mongo's Introduction

BCR2Mongo

What is this?

A simple script that reads the data from the CPD dataset and, for a given variable name, creates video-tagged HTML str that is dumped to a given mongodb collection.

How to use

The script needs a running instance of mongoDB and the relative environment variables need to be set.

Setup

  • create and activate a virtual environment by following this
  • install the requirements in requirements.txt
  • create a .env file in the root directory of the repo and add the following variables (needed):
    • MONGO_URI=<uri>
    • DB_NAME=<db_name>
    • COLLECTION_NAME=<coll_name>

Additionally, ENV and COLLECTION_NAME-DEV to keep development environments isolated.

N.B.: The environment variables are needed by the script to write the HTML string to the DB, that will be read by COVIDashIT:

Run

Once the .env has been prepared, in a shell with an active virtual environment

(venv)$ python bcr2mongo.py --var <variable-name-as-per-DPC-dataset>

Expected Output

If all goes down well, the output of, e.g.

(venv)$ python bcr2mongo.py --var totale_positivi

will be

2020-09-25 09:19:34,694 - main - [INFO] - ====================
2020-09-25 09:19:34,694 - main - [INFO] - ENVIRONMENT: dev
2020-09-25 09:19:34,694 - main - [INFO] - Doing totale_positivi
2020-09-25 09:19:34,694 - Utils - [INFO] - Getting Data
2020-09-25 09:19:35,148 - Utils - [INFO] - Done getting data
2020-09-25 09:19:35,167 - Utils - [INFO] - Making BCR
2020-09-25 09:21:55,855 - Utils - [INFO] - Done making BCR
2020-09-25 09:21:55,979 - main - [INFO] - Writing to DB to collection barcharts-dev
2020-09-25 09:22:00,013 - main - [INFO] - Done
2020-09-25 09:22:00,014 - main - [INFO] - ====================

and a new entry on the db will be created

alt_text

barchartrace2mongo's People

Contributors

fabriziomiano avatar

Watchers

 avatar  avatar

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.