mukundbhudia/covid-service-rs

covid-service-rs

Collects, processes and aggregates live COVID-19, and historical time series data from Johns Hopkins University

. The aggregated data is then used to populate a mongoDB database which supplies data to https://github.com/mukundbhudia/covid-api and subsequently https://github.com/mukundbhudia/covid-web.

This is a conversion of the (now archived) JavaScript https://github.com/mukundbhudia/covid-service project into a Rust project.

The target environment (for my personal use case) will be a Raspberry Pi 4 Model B running Ubuntu 20.04 (aarch64-unknown-linux-gnu). However any environment that supports the Rust toolchain should suffice. The service will run as a cron task at regular intervals for example every 20 minutes.

Note: only Linux & OS X environments with aarch64 & x86_64 architectures have been tested though.

Pre-requisites

Rust

  • Install Rust here.
  • Minimum Supported Rust Version (MSRV) is any 2018 edition.

For Linux

  • Make sure essential build tools (including compilers) are installed: sudo apt install build-essential.
  • OpenSSL will be needed sudo apt install libssl-dev.
  • pkg-config will be needed sudo apt install pkg-config.

For OSX

  • Xcode and Xcode command line tools: xcode-select --install.

All platforms

  • mongoDB - see: https://docs.mongodb.com/manual/installation/ for install instructions for your platform.

Development

  • Within the repo directory run cargo r "DB_URI" "DB_NAME" where DB_URI is your mongo instance and DB_NAME is your mongo database.
  • For example cargo r "mongodb://localhost:27017/" "covid19" for connection to local mongoDb instance to the database: covid19.

Production

  • To make a production build, within the repo directory run cargo b --release.
  • To run the release build, within the project directory run target/release/ "DB_URI" "DB_NAME" with the same arguments as in development.

Testing

  • To run all your tests, within the repo directory run cargo t. This will run all tests in the /tests directory.
  • To run test a specific test such as /tests/my_test.rs, within the repo directory run cargo t --test my_test.

Installation

  • If there is a release asset for your target platform, you can run a command like wget -q -O tmp.zip https://github.com/mukundbhudia//releases/download/<my_version_here>/_aarch64-unknown-linux-gnu.zip && unzip -o tmp.zip && rm tmp.zip && strip && mv /home/ubuntu/.cargo/bin/ (where <my_version_here> is the tagged version e.g. v1.0.3) to have the binary placed in the cargo bin folder.
  • For a fresh build and install on your target environment, run cargo install --path . within the repo directory. Then `` will be moved to your cargo bin directory and will be callable throughout your host environment as a standard binary.
  • To install as a cron task, an example entry under crontab -e to run the service every 20 minutes would be */20 * * * * /home/my-user-name/.cargo/bin/ "mongodb://localhost:27017/" "covid19"
  • Subsequent upgrades would then only require a git pull and cargo install --path . to be run again to build and move the binary to cargo bin.

Advanced builds (cross-compilation)

  • Run rustc --print target-list to see a list of targets you can build for.
  • You can run rustup target add <my-target> to add the specific target to your rustup toolchain. This means you can now compile and build for that target.
  • Running rustup show will show toolchains already installed on your host environment.
  • Then running cargo b --release --target=<my-target> would create the build for that environment.

For more information on cross-compilation see https://rust-lang.github.io/rustup/cross-compilation.html.

Target schema

The intended mongo database should comprise of two collections:

  • casesByLocation which holds data on every country and/or state along with the time series data. The stuct for this collection can be found as CaseByLocation in /src/schema.rs.
  • totals which holds global data including global time series data and . The stuct for this collection can be found as GlobalCaseByLocation in /src/schema.rs.

Resources & Thanks

  • To Johns Hopkins CSSE for the hard work providing and collating the data.
  • To Our World in Data for their hard work in providing rich, clear and accurate data available on COVID-19.
  • To the wonderful Rust community for their excellent book.
Versions

Find the latest versions by id

v1.3.0 - Aug 28, 2022

v1.2.6 - Dec 17, 2021

v1.2.5 - Aug 07, 2021

v1.2.4 - Jun 10, 2021

v1.2.3 - Apr 06, 2021

v1.2.2 - Feb 28, 2021

v1.2.1 - Feb 24, 2021

v1.2.0 - Feb 18, 2021

v1.1.0 - Feb 16, 2021

v1.0.5 - Feb 03, 2021

v1.0.4 - Jan 30, 2021

v1.0.3 - Jan 08, 2021

v1.0.2 - Jan 04, 2021

Test release

Information - Updated Sep 09, 2022

Stars: 2
Forks: 1
Issues: 1

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically

Rust Greatest JSON weapon is Serde with over 4.4K stars on github and a massive developer community. This is considered a core Rust library for every developer to learn in BRC's opinion

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically

Rust 버전 JsonPath 구현으로 Webassembly와 Javascript에서도 유사한 API 인터페이스를 제공 한다

JsonPath 구현으로 Webassembly와 Javascript에서도 유사한 API 인터페이스를 제공 한다

Rust 버전 JsonPath 구현으로 Webassembly와 Javascript에서도 유사한 API 인터페이스를 제공 한다

SIMD JSON for Rust  

Rust port of extremely fast serde compatibility

SIMD JSON for Rust  

JSON-E Rust data-struct paramter crate for lightweight embedded content with objects and much more

What makes JSON-e unique is that it extensive documentation and ease of use

JSON-E Rust data-struct paramter crate for lightweight embedded content with objects and much more
JSON

111

A Rust JSON5 serializer and deserializer which speaks Serde

Deserialize a JSON5 string with from_str

A Rust JSON5 serializer and deserializer which speaks Serde

Rust JSON Parser Benchmark

Download and Generate JSON Data

Rust JSON Parser Benchmark

Read JSON values quickly - Rust JSON Parser

AJSON get json value with specified path, such as project

Read JSON values quickly - Rust JSON Parser

Rust actix json request example

Send a json request to actix, and parse it

Rust actix json request example
JSON

140

json_typegen - Rust types from JSON samples

json_typegen is a collection of tools for generating types from

json_typegen - Rust types from JSON samples

Rust JSON parsing benchmarks

This project aims to provide benchmarks to show how various JSON-parsing libraries in the Rust programming language perform at various JSON-parsing tasks

Rust JSON parsing benchmarks

A tiny command line tool written in rust to print json data as a formatted...

A tiny command line tool written in rust to print json data as a formatted table

A tiny command line tool written in rust to print json data as a formatted...

Rust RPC client for Bitcoin Core JSON-RPC

rust-jsonrpc and makes it easier to talk to the Bitcoin JSON-RPC interface

Rust RPC client for Bitcoin Core JSON-RPC
Facebook Instagram Twitter GitHub Dribbble
Privacy