Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kolyaventuri/covid-act-now
A CovidActNow.org API client
https://github.com/kolyaventuri/covid-act-now
covid data typescript
Last synced: 22 days ago
JSON representation
A CovidActNow.org API client
- Host: GitHub
- URL: https://github.com/kolyaventuri/covid-act-now
- Owner: kolyaventuri
- License: gpl-3.0
- Created: 2021-07-22T01:31:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T14:42:07.000Z (over 3 years ago)
- Last Synced: 2024-11-28T06:33:41.145Z (about 1 month ago)
- Topics: covid, data, typescript
- Language: TypeScript
- Homepage:
- Size: 622 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CovidActNow
---
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
## A [CovidActNow.org](https://covidactnow.org) API client written in TypeScript._Note:_ @kolyaventuri is not affiliated with CovidActNow in any way. This is moreso a side-project, as a way to explore building a strictly typed API client from the ground up.
---
# Installing
Browser:
``Node:
`npm install @kolyaventuri/covid-act-now`# Usage
```ts
// import CovidActNow from '@kolyaventuri/covid-act-now';const client = new CovidActNow(`{API_KEY}`);
...
await client.state.az(); // Get current data for Arizona
```## Typescript Support
Types are importable on their own via the `/types` directory
```ts
import {County} from '@kolyaventuri/covid-act-now/types';
```# The API
Generally the structure follows what is outlined on CovidActNow.org, under their API docs section (https://apidocs.covidactnow.org/api/). The schema outlined in their docs is equivalent to the included type definitions.
---
## All States
### client.states()
- Returns a Promise, resolving with a summary for all states.### client.states.timeseries()
- Returns a Promise, resolving with a summary of timeseries data for all states
---
## Singular State
### client.state.\()
- Returns a Promise, resolving with a summary for a single state (ex: `client.state.az()`)### client.state.\.timeseries()
- Returns a Promise, resolving with a summary with timeseries data for a single state (ex: `client.state.az.timeseries()`)### client.state.\.counties()
- Returns a Promise, resolving with a summary for all counties for a single state (ex: `client.state.az.counties()`)### client.state\.counties.timeseries()
- Returns a Promise, resolving with a summary with timeseries data for all counties in a single state (ex: `client.state.az.counties.timeseries()`)
---
## All Counties
### client.counties()
- Returns a Promise, resolving with a summary for all counties.### client.counties.timeseries()
- Returns a Promise, resolving with a summary with timeseries data for all counties.
---
## Singular County
### client.county('{fipsCode}')()
- Returns a Promise, resolving with a summary of a single county.### client.county(`{fipsCode}`).timeseries()
- Returns a Promise, resolving with a summary with timeseries data for a single county.### All counties in a state
- See entry under Singular State.
---
## All Metros (CBSAs)
### client.metros()
- Returns a Promise, resolving with a summary for all metro areas.
### client.metros.timeseries()
- Returns a Promise, resolving with a summary with timeseries data for all metro areas.---
## Singular Metro (CBSA)
### client.metro(`{fipsCode}`)()
- Returns a Promise, resolving with a summary for a single metro area.### client.metro(`{fipsCode}`).timeseries()
- Returns a Promise, resolving with a summary with timeseries data for a single metro area.
---
## Country Level Data
### client.country()
- Returns a Promise, resolving with a summary for the entire United States.
### client.country.timeseries()
- Returns a Promise, resolving with a summary with timeseries data for the entire United States.---
# Contributing
PRs are more than welcome! There's some more work to do, such as parsing dates out of the response data (`string -> Date` conversion), and some more robust docs.## Running Tests
- `npm run test` will run the linter (`tsc && xo`), and the test with `ava`
- `npm run test:integration` will run a basic integration suite, provided you have defined your `COVID_ACT_NOW_KEY` in a `.env` file (see `.env.example`)