Skip to content

Commit 3e09bb7

Browse files
committed
replace Covidcast packages with epidatr/py
1 parent 6ba49c7 commit 3e09bb7

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/modes/exportdata/ExportData.svelte

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -448,52 +448,52 @@
448448
</p>
449449
</div>
450450
<div>
451-
<h3 class="mobile-h3 uk-margin-top">Python Package</h3>
452-
<p>Install <code>covidcast</code> via pip:</p>
453-
<pre class="code-block"><code>pip install covidcast</code></pre>
451+
<h3 class="mobile-h3 uk-margin-top">Python Package: Epidatpy</h3>
452+
<p>Install <code>epidatpy</code> via pip:</p>
453+
<pre class="code-block"><code>pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy"</code></pre>
454454
<p>Fetch data:</p>
455455
<pre class="code-block"><code>
456-
{`${isWeekly ? 'from epiweeks import Week' : 'from datetime import date'}
457-
import covidcast
458-
459-
data = covidcast.signal("${sensor ? sensor.id : ''}", "${sensor ? sensor.signal : ''}",
460-
${formatPythonDate(startDate)}, ${formatPythonDate(endDate)},
461-
"${geoType}"${isAllRegions ? '' : `, ["${geoIDs.join('", "')}"]`}${
462-
usesAsOf ? `, as_of = ${formatPythonDate(asOfDate)}` : ''
463-
})`}
456+
{`${isWeekly ? from epiweeks import Week' : 'from datetime import date'}
457+
from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange
458+
459+
epidata = EpiDataContext(use_cache=True, cache_max_age_days=7)
460+
461+
apicall = epidata.pub_covidcast(
462+
data_source="${sensor ? sensor.id : ''}",
463+
signals="${sensor ? sensor.signal : ''}",
464+
geo_type="${geoType}"${isAllRegions ? '' : `, "${geoIDs.join(', ')}"`},
465+
time_type="week",
466+
time_values=EpiRange(${formatDate(startDate)}, ${formatDate(endDate)}),${usesAsOf ? `
467+
, as_of = ${asOfDate}` : ''}
468+
)
469+
print(apicall)
470+
apicall.df()`}
464471
</code></pre>
465472
<p class="description">
466473
For more details and examples, see the
467-
<a href="https://cmu-delphi.github.io/covidcast/covidcast-py/html/">package documentation</a>. A description
468-
of the returned data structure can be found at:
469-
<a href="https://cmu-delphi.github.io/covidcast/covidcast-py/html/signals.html#covidcast.signal"
470-
>covidcast.signal</a
471-
>.
474+
<a href="https://cmu-delphi.github.io/epidatpy/">package documentation</a>.
472475
</p>
473476
</div>
474477
<div>
475-
<h3 class="mobile-h3 uk-margin-top">R Package</h3>
476-
<p>Install <code>covidcast</code> via CRAN:</p>
477-
<pre class="code-block"><code>install.packages('covidcast')</code></pre>
478+
<h3 class="mobile-h3 uk-margin-top">R Package: Epidatr</h3>
479+
<p>Install <code>epidatr</code> via CRAN:</p>
480+
<pre class="code-block"><code>install.packages('epidatr')</code></pre>
478481
<p>Fetch data:</p>
479482
<pre class="code-block"><code>
480-
{`library(covidcast)
481-
482-
cc_data <- covidcast_signal(
483-
data_source = "${sensor ? sensor.id : ''}", signal = "${sensor ? sensor.signal : ''}",
484-
start_day = "${formatDate(startDate)}", end_day = "${formatDate(endDate)}",
485-
geo_type = "${geoType}"${isAllRegions ? '' : `, geo_values = c("${geoIDs.join('", "')}")`}${
486-
usesAsOf ? `, as_of = "${formatDate(asOfDate)}"` : ''
483+
{`library(epidatr)
484+
485+
cc_data <- pub_covidcast(
486+
source = "${sensor ? sensor.id : ''}",
487+
signal = "${sensor ? sensor.signal : ''}",
488+
time_values = epirange(${formatDate(startDate)}, ${formatDate(endDate)}),
489+
geo_type = "${geoType}"${isAllRegions ? '' : `, geo_values = c("${geoIDs.join('", "')}")`}${
490+
usesAsOf ? `, as_of = "${asOfDate}"` : ''
487491
}
488492
)`}
489493
</code></pre>
490494
<p class="description">
491495
For more details and examples, see the
492-
<a href="https://cmu-delphi.github.io/covidcast/covidcastR/">package documentation</a>. A description of the
493-
returned data structure can be found at:
494-
<a href="https://cmu-delphi.github.io/covidcast/covidcastR/reference/covidcast_signal.html#value"
495-
>covidcast_signal</a
496-
>.
496+
<a href="https://cmu-delphi.github.io/epidatr/">package documentation</a>.
497497
</p>
498498
</div>
499499
</section>

0 commit comments

Comments
 (0)