Skip to content

Instantly share code, notes, and snippets.

@sacundim
sacundim / spec.json
Last active July 11, 2020 07:35
Casos nuevos COVID-19 Puerto Rico, datos hasta el 11 de Julio del 2020
{
"config": {
"axis": {"labelFontSize": 14, "titleFontSize": 14},
"header": {"labelFontSize": 14, "titleFontSize": 14},
"legend": {"labelFontSize": 14, "titleFontSize": 14},
"title": {"align": "center", "fontSize": 20, "offset": 15},
"concat": {"spacing": 40},
"view": {"strokeWidth": 0}
},
"repeat": {
@sacundim
sacundim / gist:5386823
Last active July 28, 2020 21:32
Toy instructional example of Haskell GADTs: simple dynamic types.
{-# LANGUAGE GADTs #-}
-- | Toy instructional example of GADTs: simple dynamic types.
--
-- Before tackling this, skim the GHC docs section on GADTs:
--
-- <http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt>
--
-- As you read this example keep in mind this quote from the
-- docs: "The key point about GADTs is that /pattern matching
@sacundim
sacundim / spec.json
Last active September 8, 2020 04:31
Casos y hospitalizaciones COVID-19
{
"config": {
"axis": {"labelFontSize": 14, "titleFontSize": 14},
"header": {"labelFontSize": 14, "titleFontSize": 14},
"legend": {"labelFontSize": 14, "titleFontSize": 14},
"title": {"align": "center", "fontSize": 32, "offset": 15, "subtitleFontSize": 18}
},
"title": {
"text": "Casos nuevos, muertes y hospitalizaciones por COVID-19 en Puerto Rico",
"subtitle": "Fuentes: Departamento de Salud de Puerto Rico; CovidTracking.com"
@sacundim
sacundim / lateness_7day_2020-09-18.csv
Created September 19, 2020 22:10
Cálculo de rezago de casos en Puerto Rico, con desviación estándar
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 7 columns, instead of 1. in line 8.
"bulletin_date","confirmed_cases_additions","confirmed_cases_additions_stdev","probable_cases_additions","probable_cases_additions_stdev","deaths_additions","deaths_additions_stdev"
2020-09-18,6.83547103051747,8.28518645302639,10.418001104362231,16.0563711061978,3.7857142857142856,3.290214309749691
2020-09-17,6.51575456053068,9.02841779065785,7.35587431693989,13.89022117105862,3.8289473684210527,3.1680483694088584
2020-09-16,6.624133148404993,9.977585148014404,8.029816513761467,15.159897937351689,3.6710526315789473,3.1969893645787932
2020-09-15,6.445972495088409,9.58193880338032,8.068917018284107,14.882834629834234,3.342857142857143,3.2155235711676404
2020-09-14,6.252221462747778,8.32121411991202,6.525297619047619,8.2422916676876,3.420289855072464,2.6670604624168037
2020-09-13,6.221391174270756,8.556139927009891,6.670618120237087,8.715605945744715,3.8923076923076922,2.7797237102498955
2020-09-12,6.231314432989691,7.451559985023958,6.2477570738440305,8.111628678262015,3.838709677419355,2.795119873862512
2020-0
@sacundim
sacundim / prpht-levels-cases.json
Last active September 20, 2020 04:43
Indicadores Propuestos Grupo PRPHT
{
"config": {
"axis": {"labelFontSize": 14, "titleFontSize": 14},
"header": {"labelFontSize": 14, "titleFontSize": 14},
"legend": {"labelFontSize": 14, "titleFontSize": 14},
"title": {"align": "center", "fontSize": 20, "offset": 15, "subtitleFontSize": 16}
},
"title": {
"text": "Casos confirmados de COVID-19 en Puerto Rico y umbrales propuestos por PRPHT",
"subtitle": "Datos: Departamento de Salud (hasta 18 de septiembre del 2020)"
@sacundim
sacundim / spec.json
Created September 27, 2020 06:46
Ill-formed JSON produced by Altair (NaN at line 111)
{
"config": {
"axis": {
"labelFontSize": 14,
"titleFontSize": 14
},
"header": {
"labelFontSize": 14,
"titleFontSize": 14
},
@sacundim
sacundim / Covímetro 2020-09-27.csv
Last active September 28, 2020 16:49
Búsqueda de SQL (Postgres) para calcular el Covímetro a partir de mi base de datos de COVID-19 en Puerto Rico.
bulletin_date datum_date confirmed_cases sum_a sum_b covimetro
2020-09-27 2020-09-23 77 15616.000000000000
2020-09-27 2020-09-22 138 15672.000000000000 15584.857142857143 0.00559150824059984045
2020-09-27 2020-09-21 209 15657.857142857143 15522.285714285714 0.00873398615815052107
2020-09-27 2020-09-20 30 15798.285714285714 15598.857142857143 0.01278481940068866755
2020-09-27 2020-09-19 79 15902.857142857143 15616.285714285714 0.01835080593519588558
2020-09-27 2020-09-18 359 15921.285714285714 15597.285714285714 0.02077284509209477878
2020-09-27 2020-09-17 504 15889.285714285714 15528.142857142857 0.02325731160933603525
2020-09-27 2020-09-16 687 15849.142857142857 15487.285714285714 0.02336478770604459923
2020-09-27 2020-09-15 400 15551.285714285714 15179.571428571429 0.02448779845092553833
@sacundim
sacundim / bad-spec.json
Last active November 8, 2020 05:41
Vega-Lite stroke dash legend issue example
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"data": {
"name": "data-a58954460ff4479c7f925351d53a938d"
},
"mark": {
"type": "line",
"point": "transparent",
"tooltip": true
},
We can't make this file beautiful and searchable because it's too large.
hospital_pk,collection_week,state,ccn,hospital_name,address,city,zip,hospital_subtype,fips_code,is_metro_micro,total_beds_7_day_avg,all_adult_hospital_beds_7_day_avg,all_adult_hospital_inpatient_beds_7_day_avg,inpatient_beds_used_7_day_avg,all_adult_hospital_inpatient_bed_occupied_7_day_avg,total_adult_patients_hospitalized_confirmed_and_suspected_covid_7_day_avg,total_adult_patients_hospitalized_confirmed_covid_7_day_avg,total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_7_day_avg,total_pediatric_patients_hospitalized_confirmed_covid_7_day_avg,inpatient_beds_7_day_avg,total_icu_beds_7_day_avg,total_staffed_adult_icu_beds_7_day_avg,icu_beds_used_7_day_avg,staffed_adult_icu_bed_occupancy_7_day_avg,staffed_icu_adult_patients_confirmed_and_suspected_covid_7_day_avg,staffed_icu_adult_patients_confirmed_covid_7_day_avg,total_patients_hospitalized_confirmed_influenza_7_day_avg,icu_patients_confirmed_influenza_7_day_avg,total_patients_hospitalized_confirmed_influenza_and_covid_7_day_avg,total_beds_7
@sacundim
sacundim / rezago_muertes.csv
Created January 22, 2021 19:56
Rezago de anuncio de muertes en Puerto Rico, promedios de 7 días
Fecha datos Rezago muertes (promedio 7 días) Desviación estándar
2021-01-20 8.18867924528302 11.814696003360957
2021-01-19 10.983050847457626 18.008935188526088
2021-01-18 13.016949152542374 19.906128453678875
2021-01-17 12.5 19.55698868567482
2021-01-16 11.297297297297296 18.15453910163228
2021-01-15 12.613636363636363 18.97751769030793
2021-01-14 16.11881188118812 21.348725066258883
2021-01-13 16.054347826086957 21.169791916598058
2021-01-12 17.617977528089888 22.070115855770567