GithubHelp home page GithubHelp logo

hurleywong / uol-covid19 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 16 KB

Scrape the coronavirus case data from the University of Leeds website and generate the .csv files, make it as an Endpoint API Service

License: Apache License 2.0

Python 100.00%
leeds leeds-university uol covid-19 covid19 covid scraper python csv

uol-covid19's Introduction

uol-covid19

This repository contains

  • A CSV file of aggregated coronavirus case data scraped from the University of Leeds website
  • Python code for the scraper
  • Python code to process and analyze the data

Scraper Usage Examples

To scrape case data and write to a new file in the scraper folder:

python daily-cases.py cases.csv

or in the root folder:

python scraper/daily-cases.py cases.csv

To scrape case data and update an existing CSV file in the scraper folder:

python daily-cases.py --update cases.csv

or in the root folder:

python scraper/daily-cases.py --update cases.csv

Note: if the newly-scraped data contains records whose dates match existing records, those existing records will be replaced by the new data.

API

In order to make this project to fetch data via the API, the Flask framework has been added to this project to enable this. You can start the service by running the extract.py file and then get the number of cases for the latest date and the latest week in the following links:

  • To get the cases of latest day, access http://127.0.0.1:5000/latest in your browser
  • To get the cases of latest week, access http://127.0.0.1:5000/days in your browser

Analysis Examples

To derive day-by-day active cases from a CSV file of daily case reports in the root folder:

python analysis/active-cases.py data/2021-cases.csv

This will display the active cases on screen as a table. To output the active cases to a file, do:

python analysis/active-cases.py -o data/2021-active.csv data/2021-cases.csv

Dependencies

To use the scripts, create and activate a Python 3 virtual environment, then do:

pip install -r requirements.txt

or choose to install dependecies in this way:

pip install requests
pip install beautifulsoup4
pip install rich

uol-covid19's People

Contributors

hurleywong avatar

Stargazers

 avatar

Watchers

 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.