Tracking COVID Wastewater data in US

The CDC is now publishing amount of COVID in wastewater in the US.

I decided to create a simple tracker for this.

Here’s what I did (using Seattle’s data as an example - you can find the right query in the CDC’s Data Explorer

sensor:
  - platform: command_line                                                      
    name: "COVID WasteWater"
    scan_interval: 86400
    command: >
      echo "{ \"data\":" $(
      curl -s https://data.cdc.gov/resource/g653-rqe2.json?key_plot_id=CDC_BIOBOT_wa_1139_Treatment%20plant_raw%20wastewater                   
      ) "}"
    value_template: >
      {{ value_json.data | length }}
    json_attributes:
      - data

and then I used the really nice Apex Charts Card

like so:

type: custom:apexcharts-card
header:
  title: King County COVID Wastewater
  show: true
  colorize_states: true
graph_span: 90d
chart_type: scatter
series:
  - entity: sensor.covid_wastewater
    data_generator: |
      var filtered_data = entity.attributes.data.filter(function(record) {
        return 'pcr_conc_smoothed' in record;
      });

      var filtered_map = filtered_data.map(record => {
        return [new Date(record.date).getTime(), record.pcr_conc_smoothed/1000000];
      });

      return filtered_map;

End result:

4 Likes