Skip to content
Snippets Groups Projects
Commit 8a3562df authored by CI-bot's avatar CI-bot Committed by renku 0.10.4
Browse files

renku rerun data/covidtracking/states-metadata.json data/covidtracking/states-daily.json

parent 9b0313a0
No related branches found
No related tags found
1 merge request!359Automatic update - auto-update_2020-11-04_08-01
Pipeline #100449 failed
class: Workflow
cwlVersion: v1.0
hints: []
inputs:
input_1:
default: states-metadata.json
streamable: false
type: string
input_2:
default: states-daily.json
streamable: false
type: string
input_3:
default: out_folder
streamable: false
type: string
input_4:
default: data/covidtracking
streamable: false
type: string
input_5:
default:
class: File
path: ../../notebooks/process/download-covidtracking-data.ipynb
streamable: false
type: File
input_6:
default: runs/download-covidtracking-data.runs.ipynb
streamable: false
type: string
outputs:
output_2:
outputSource: step_3/output_0
streamable: false
type: File
output_3:
outputSource: step_3/output_1
streamable: false
type: Directory
requirements: []
steps:
step_1:
in:
filename: input_1
input_directory: step_3/output_1
out:
- output_file
run:
arguments: []
baseCommand:
- 'true'
class: CommandLineTool
cwlVersion: v1.0
hints: []
inputs:
filename:
default: states-metadata.json
streamable: false
type: string
input_directory:
streamable: false
type: Directory
outputs:
output_file:
outputBinding:
glob: $(inputs.filename)
streamable: false
type: File
permanentFailCodes: []
requirements:
- &id001
class: InlineJavascriptRequirement
- &id002
class: InitialWorkDirRequirement
listing: $(inputs.input_directory.listing)
successCodes: []
temporaryFailCodes: []
step_2:
in:
filename: input_2
input_directory: step_3/output_1
out:
- output_file
run:
arguments: []
baseCommand:
- 'true'
class: CommandLineTool
cwlVersion: v1.0
hints: []
inputs:
filename:
default: states-daily.json
streamable: false
type: string
input_directory:
streamable: false
type: Directory
outputs:
output_file:
outputBinding:
glob: $(inputs.filename)
streamable: false
type: File
permanentFailCodes: []
requirements:
- *id001
- *id002
successCodes: []
temporaryFailCodes: []
step_3:
in:
input_1: input_3
input_2: input_4
input_3: input_5
input_4: input_6
out:
- output_1
- output_0
run: a17d560c41a54f5aa307ce5f3c5effe5_papermill.cwl
source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
%% Cell type:code id: tags:
``` python
import requests
import os
import pandas as pd
```
%% Cell type:code id: tags:parameters
``` python
out_folder = "../data/covidtracking/"
PAPERMILL_OUTPUT_PATH = None
```
%% Cell type:code id: tags:injected-parameters
``` python
# Parameters
PAPERMILL_INPUT_PATH = "/tmp/qj7q4luy/notebooks/process/download-covidtracking-data.ipynb"
PAPERMILL_INPUT_PATH = "/tmp/po7g_8x1/notebooks/process/download-covidtracking-data.ipynb"
PAPERMILL_OUTPUT_PATH = "runs/download-covidtracking-data.runs.ipynb"
out_folder = "data/covidtracking"
```
%% Cell type:markdown id: tags:
# Download state metadata
Download a dataset of URLs for data for each US state and several territories. See [Google Doc](https://docs.google.com/spreadsheets/d/18oVRrHj3c183mHmq3m89_163yuYltLNlOmPerQ18E8w/htmlview?sle=true).
%% Cell type:code id: tags:
``` python
url = 'http://covidtracking.com/api/states/info'
r = requests.get(url, allow_redirects=True)
states_metadata_json = r.content
```
%% Cell type:code id: tags:
``` python
# save the result
if PAPERMILL_OUTPUT_PATH:
out_path = os.path.join(out_folder, 'states-metadata.json')
with open(out_path, 'wb') as f:
f.write(states_metadata_json)
```
%% Cell type:code id: tags:
``` python
metadata_df = pd.read_json(states_metadata_json)
print(len(metadata_df), "states and territories have metadata")
metadata_df.head(2)
```
%% Output
56 states and territories have metadata
state notes \
0 AK Alaska combines PCR and antigen tests in the t...
1 AL Alabama combines PCR and antigen tests in the ...
covid19Site \
0 http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-...
1 https://alpublichealth.maps.arcgis.com/apps/op...
covid19SiteSecondary \
0 https://experience.arcgis.com/experience/ed1c8...
1 https://alpublichealth.maps.arcgis.com/apps/op...
covid19SiteTertiary covid19SiteQuaternary \
0 https://alaska-dhss.maps.arcgis.com/apps/opsda... None
1 https://services7.arcgis.com/4RQmZZ0yaZkGR1zy/... None
covid19SiteQuinary twitter \
0 None @Alaska_DHSS
1 None @alpublichealth
covid19SiteOld \
0 http://dhss.alaska.gov/dph/Epi/id/Pages/COVID-...
1 http://www.alabamapublichealth.gov/infectiousd...
covidTrackingProjectPreferredTotalTestUnits \
0 Specimens
1 Unclear units
covidTrackingProjectPreferredTotalTestField totalTestResultsField pui \
0 totalTestsViral Total Tests (PCR) All data
1 totalTestsViral Total Tests (PCR) No data
pum name fips
0 False Alaska 2
1 False Alabama 1
%% Cell type:markdown id: tags:
# Download daily state data
%% Cell type:code id: tags:
``` python
url = 'https://covidtracking.com/api/states/daily'
r = requests.get(url, allow_redirects=True)
states_daily_json = r.content
```
%% Cell type:code id: tags:
``` python
# save the result
if PAPERMILL_OUTPUT_PATH:
out_path = os.path.join(out_folder, 'states-daily.json')
with open(out_path, 'wb') as f:
f.write(states_daily_json)
```
%% Cell type:code id: tags:
``` python
data_df = pd.read_json(states_daily_json)
print(len(data_df), "data points")
data_df.head(2)
```
%% Output
13663 data points
13775 data points
date state positive probableCases negative pending \
0 20201101 AK 16705.0 NaN 587852.0 NaN
1 20201101 AL 193985.0 28746.0 1187341.0 NaN
0 20201103 AK 17448.0 NaN 607307.0 NaN
1 20201103 AL 195929.0 29302.0 1196422.0 NaN
totalTestResultsSource totalTestResults hospitalizedCurrently \
0 totalTestsViral 604207.0 98.0
1 totalTestsViral 1352580.0 967.0
0 totalTestsViral 624755.0 97.0
1 totalTestsViral 1363049.0 1022.0
hospitalizedCumulative ... posNeg deathIncrease hospitalizedIncrease \
0 NaN ... 604557 1 0
1 20450.0 ... 1381326 6 0
0 NaN ... 624755 0 0
1 20901.0 ... 1392351 14 451
hash commercialScore \
0 0fe81cb4b3a17588cfde8bbd309c3f0f2e786fd2 0
1 0bd0f2572848cf6f46a651c076d32afceb8dc6a1 0
0 e4b7b20d6a7724e14ce53e37e1d543c6bf1176c9 0
1 f6dd94c1b534c3e4a74e78d1859fcc12ae1ef103 0
negativeRegularScore negativeScore positiveScore score grade
0 0 0 0 0
1 0 0 0 0
[2 rows x 55 columns]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment