Class CovidActNowDataProvider

Data provider to ingest data from the Covid Act Now API.

Access nested JSON API data using dot notation. E.g.:

  • For newCases data, set metric.dataReference.column to actuals.newCases.
  • For hospital bed capacity, set metric.dataReference.column to actuals.hospitalBeds.capacity.
  • For the CAN Community Level, set metric.dataReference.column to communityLevels.canCommunityLevel.

Hierarchy

  • CovidActNowDataProvider

Implements

Constructors

Properties

apiJson: {
    [regionId: string]: Promise<DataRow>;
}

Cached CAN API responses indexed by the FIPS codes of the regions fetched.

Type declaration

  • [regionId: string]: Promise<DataRow>
apiKey: string

Valid Covid Act Now API key to use in API calls.

id: string

A unique provider id to associate with the provider (e.g. "can-api"). This ID can be used from a MetricDataReference in a metric to reference the data from this provider.

Methods

  • Construct a Covid Act Now API url for a given region.

    Returns

    Covid Act Now API url for the given region and timeseries specification.

    Parameters

    • region: Region

      Region to create url for

    • includeTimeseries: boolean

      Whether to include timeseries data in API url.

    Returns string

  • Private helper method to retrieve data from cache.

    Always returns timeseries data if it exists, otherwise, if includeTimeseries is false, return non-timeseries data if it exists.

    Returns

    Data from cache, or undefined if no data found.

    Parameters

    • region: Region

      Region to retrieve data for

    • includeTimeseries: boolean

      Whether timeseries data is necessary.

    Returns undefined | Promise<DataRow>

  • Checks if we have cached data for the specified regions already, else initiates requests to fetch them. Note that we do not wait on them to finish. We just asynchronously start the requests and cache the promises.

    Parameters

    • regions: Region[]

      Regions to ensure are cached.

    • includeTimeseries: boolean

      Whether timeseries data is required.

    Returns void

Generated using TypeDoc