Skip to content

Commit

Permalink
feat(vax,peru): add age data @jmcastagnetto #1864
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas rg committed Aug 19, 2021
1 parent b58615a commit 2a40909
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 0 deletions.
196 changes: 196 additions & 0 deletions scripts/output/vaccinations/by_age_group/Peru.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
location,date,age_group_min,age_group_max,people_vaccinated_per_hundred,people_fully_vaccinated_per_hundred
Peru,2021-02-08,18,24.0,0.0437,
Peru,2021-02-08,25,49.0,0.6417,
Peru,2021-02-08,50,59.0,0.5601,
Peru,2021-02-08,60,69.0,0.3183,
Peru,2021-02-08,70,79.0,0.0057,
Peru,2021-02-08,80,,0.0015,
Peru,2021-02-15,0,17.0,0.0,
Peru,2021-02-15,18,24.0,0.1599,
Peru,2021-02-15,25,49.0,1.1545,0.0001
Peru,2021-02-15,50,59.0,1.0163,
Peru,2021-02-15,60,69.0,0.7539,
Peru,2021-02-15,70,79.0,0.018,
Peru,2021-02-15,80,,0.0043,
Peru,2021-02-22,0,17.0,0.0001,
Peru,2021-02-22,18,24.0,0.3213,0.0001
Peru,2021-02-22,25,49.0,1.8128,0.0001
Peru,2021-02-22,50,59.0,1.6366,0.0001
Peru,2021-02-22,60,69.0,1.4566,0.0001
Peru,2021-02-22,70,79.0,0.0556,
Peru,2021-02-22,80,,0.0182,
Peru,2021-03-01,0,17.0,0.0001,
Peru,2021-03-01,18,24.0,0.3768,0.0361
Peru,2021-03-01,25,49.0,2.0021,0.5544
Peru,2021-03-01,50,59.0,1.7892,0.5051
Peru,2021-03-01,60,69.0,1.6739,0.2951
Peru,2021-03-01,70,79.0,0.0775,0.0056
Peru,2021-03-01,80,,0.0234,0.0004
Peru,2021-03-08,0,17.0,0.0002,0.0
Peru,2021-03-08,18,24.0,0.6505,0.1243
Peru,2021-03-08,25,49.0,2.2495,0.9931
Peru,2021-03-08,50,59.0,2.2092,0.9037
Peru,2021-03-08,60,69.0,1.8639,0.6733
Peru,2021-03-08,70,79.0,0.2791,0.0173
Peru,2021-03-08,80,,1.9478,0.0058
Peru,2021-03-15,0,17.0,0.0004,0.0
Peru,2021-03-15,18,24.0,1.0988,0.2742
Peru,2021-03-15,25,49.0,2.6583,1.6198
Peru,2021-03-15,50,59.0,2.4646,1.5048
Peru,2021-03-15,60,69.0,2.1359,1.3502
Peru,2021-03-15,70,79.0,1.0685,0.0529
Peru,2021-03-15,80,,8.131,0.0124
Peru,2021-03-22,0,17.0,0.0005,
Peru,2021-03-22,18,24.0,1.46,0.3298
Peru,2021-03-22,25,49.0,2.8332,1.829
Peru,2021-03-22,50,59.0,2.5912,1.666
Peru,2021-03-22,60,69.0,2.3856,1.5673
Peru,2021-03-22,70,79.0,1.7682,0.0741
Peru,2021-03-22,80,,12.0523,0.0166
Peru,2021-03-29,0,17.0,0.0005,0.0001
Peru,2021-03-29,18,24.0,1.5141,0.5709
Peru,2021-03-29,25,49.0,2.9309,2.0391
Peru,2021-03-29,50,59.0,2.6598,2.0578
Peru,2021-03-29,60,69.0,2.4703,1.7261
Peru,2021-03-29,70,79.0,1.8763,0.2382
Peru,2021-03-29,80,,12.9123,1.7306
Peru,2021-04-05,0,17.0,0.0006,0.0003
Peru,2021-04-05,18,24.0,1.7505,0.8286
Peru,2021-04-05,25,49.0,3.3042,2.3443
Peru,2021-04-05,50,59.0,2.9026,2.2738
Peru,2021-04-05,60,69.0,2.623,1.974
Peru,2021-04-05,70,79.0,2.0081,0.8896
Peru,2021-04-05,80,,13.1752,6.5552
Peru,2021-04-12,0,17.0,0.0006,0.0003
Peru,2021-04-12,18,24.0,1.9206,1.3394
Peru,2021-04-12,25,49.0,3.35,2.662
Peru,2021-04-12,50,59.0,2.9345,2.4657
Peru,2021-04-12,60,69.0,2.6463,2.2534
Peru,2021-04-12,70,79.0,2.0844,1.6472
Peru,2021-04-12,80,,19.4291,11.1325
Peru,2021-04-19,0,17.0,,0.0004
Peru,2021-04-19,18,24.0,2.0098,1.422
Peru,2021-04-19,25,49.0,3.5476,2.7717
Peru,2021-04-19,50,59.0,3.1333,2.5406
Peru,2021-04-19,60,69.0,2.7124,2.3472
Peru,2021-04-19,70,79.0,2.9899,1.7479
Peru,2021-04-19,80,,29.8524,12.1409
Peru,2021-04-26,0,17.0,,0.0004
Peru,2021-04-26,18,24.0,2.0718,1.5941
Peru,2021-04-26,25,49.0,3.6113,3.1005
Peru,2021-04-26,50,59.0,3.1682,2.7568
Peru,2021-04-26,60,69.0,3.4664,2.4827
Peru,2021-04-26,70,79.0,13.1906,1.8483
Peru,2021-04-26,80,,46.8758,12.3534
Peru,2021-05-03,0,17.0,0.0006,0.0004
Peru,2021-05-03,18,24.0,2.1712,1.7379
Peru,2021-05-03,25,49.0,3.6569,3.1648
Peru,2021-05-03,50,59.0,3.1841,2.8005
Peru,2021-05-03,60,69.0,4.5299,2.5205
Peru,2021-05-03,70,79.0,25.6973,1.9454
Peru,2021-05-03,80,,59.2548,17.4201
Peru,2021-05-10,0,17.0,0.0011,0.0004
Peru,2021-05-10,18,24.0,2.3729,1.8728
Peru,2021-05-10,25,49.0,3.7946,3.2951
Peru,2021-05-10,50,59.0,3.267,2.9484
Peru,2021-05-10,60,69.0,6.9459,2.5801
Peru,2021-05-10,70,79.0,46.75,2.7427
Peru,2021-05-10,80,,64.218,27.6094
Peru,2021-05-17,0,17.0,0.0017,
Peru,2021-05-17,18,24.0,2.5137,1.9218
Peru,2021-05-17,25,49.0,3.9105,3.373
Peru,2021-05-17,50,59.0,3.4374,3.0131
Peru,2021-05-17,60,69.0,15.562,2.8081
Peru,2021-05-17,70,79.0,62.1064,9.0919
Peru,2021-05-17,80,,68.003,38.115
Peru,2021-05-24,0,17.0,0.0028,0.0004
Peru,2021-05-24,18,24.0,2.6665,2.0313
Peru,2021-05-24,25,49.0,4.0859,3.4681
Peru,2021-05-24,50,59.0,4.1727,3.0503
Peru,2021-05-24,60,69.0,34.6121,3.2393
Peru,2021-05-24,70,79.0,66.5334,19.0666
Peru,2021-05-24,80,,70.1356,49.9724
Peru,2021-05-31,0,17.0,0.0033,0.0006
Peru,2021-05-31,18,24.0,2.7559,2.0976
Peru,2021-05-31,25,49.0,4.2025,3.5007
Peru,2021-05-31,50,59.0,4.9152,3.0742
Peru,2021-05-31,60,69.0,45.264,3.7743
Peru,2021-05-31,70,79.0,68.0977,31.6468
Peru,2021-05-31,80,,71.3435,53.0455
Peru,2021-06-07,0,17.0,0.0037,0.0013
Peru,2021-06-07,18,24.0,2.8298,2.204
Peru,2021-06-07,25,49.0,4.3152,3.5964
Peru,2021-06-07,50,59.0,6.5853,3.1998
Peru,2021-06-07,60,69.0,62.3057,11.3015
Peru,2021-06-07,70,79.0,70.7733,54.8438
Peru,2021-06-07,80,,73.5615,61.8673
Peru,2021-06-14,0,17.0,0.0041,0.0022
Peru,2021-06-14,18,24.0,2.9813,2.4084
Peru,2021-06-14,25,49.0,4.6573,3.8055
Peru,2021-06-14,50,59.0,7.9279,3.857
Peru,2021-06-14,60,69.0,67.4554,30.3729
Peru,2021-06-14,70,79.0,72.9937,62.2232
Peru,2021-06-14,80,,75.501,65.6983
Peru,2021-06-21,0,17.0,0.0047,0.0026
Peru,2021-06-21,18,24.0,3.2377,2.5811
Peru,2021-06-21,25,49.0,5.0901,3.9812
Peru,2021-06-21,50,59.0,13.6007,4.5524
Peru,2021-06-21,60,69.0,69.8745,42.1547
Peru,2021-06-21,70,79.0,74.7783,64.4565
Peru,2021-06-21,80,,77.2936,67.4661
Peru,2021-06-28,0,17.0,0.0053,0.0029
Peru,2021-06-28,18,24.0,3.3938,2.6665
Peru,2021-06-28,25,49.0,5.4138,4.0838
Peru,2021-06-28,50,59.0,26.357,5.8322
Peru,2021-06-28,60,69.0,71.769,57.2864
Peru,2021-06-28,70,79.0,76.1316,66.5665
Peru,2021-06-28,80,,78.5816,69.1522
Peru,2021-07-05,0,17.0,0.007,0.0031
Peru,2021-07-05,18,24.0,3.6495,2.7908
Peru,2021-07-05,25,49.0,7.621,4.3802
Peru,2021-07-05,50,59.0,46.4217,7.1428
Peru,2021-07-05,60,69.0,74.2306,63.0057
Peru,2021-07-05,70,79.0,77.6793,68.6789
Peru,2021-07-05,80,,79.962,71.0284
Peru,2021-07-12,0,17.0,0.0088,0.0035
Peru,2021-07-12,18,24.0,3.894,2.9903
Peru,2021-07-12,25,49.0,11.3949,4.7414
Peru,2021-07-12,50,59.0,59.5408,11.9401
Peru,2021-07-12,60,69.0,75.7526,65.8769
Peru,2021-07-12,70,79.0,78.6374,70.7701
Peru,2021-07-12,80,,80.7395,73.0526
Peru,2021-07-19,0,17.0,0.0209,0.0039
Peru,2021-07-19,18,24.0,4.5125,3.121
Peru,2021-07-19,25,49.0,16.6466,5.033
Peru,2021-07-19,50,59.0,64.804,22.9189
Peru,2021-07-19,60,69.0,76.865,67.7348
Peru,2021-07-19,70,79.0,79.3147,72.2344
Peru,2021-07-19,80,,81.2544,74.4167
Peru,2021-07-26,0,17.0,0.0292,0.0046
Peru,2021-07-26,18,24.0,4.7761,3.2589
Peru,2021-07-26,25,49.0,19.1828,6.5213
Peru,2021-07-26,50,59.0,67.2068,39.5683
Peru,2021-07-26,60,69.0,77.5,69.8919
Peru,2021-07-26,70,79.0,79.7219,73.6894
Peru,2021-07-26,80,,81.5705,75.7515
Peru,2021-08-02,0,17.0,0.0329,0.0061
Peru,2021-08-02,18,24.0,5.2542,3.4591
Peru,2021-08-02,25,49.0,23.4668,9.7788
Peru,2021-08-02,50,59.0,69.7808,52.7075
Peru,2021-08-02,60,69.0,78.3265,71.7742
Peru,2021-08-02,70,79.0,80.2916,74.9117
Peru,2021-08-02,80,,81.9685,76.7812
Peru,2021-08-09,0,17.0,0.0412,0.0126
Peru,2021-08-09,18,24.0,5.5823,3.8362
Peru,2021-08-09,25,49.0,26.3912,13.2854
Peru,2021-08-09,50,59.0,71.4098,57.3588
Peru,2021-08-09,60,69.0,79.0101,72.8346
Peru,2021-08-09,70,79.0,80.8351,75.5822
Peru,2021-08-09,80,,82.3547,77.3106
Peru,2021-08-16,0,17.0,0.0455,0.0177
Peru,2021-08-16,18,24.0,5.6066,3.8931
Peru,2021-08-16,25,49.0,26.7453,14.7055
Peru,2021-08-16,50,59.0,71.6683,58.1304
Peru,2021-08-16,60,69.0,79.1335,73.0823
Peru,2021-08-16,70,79.0,80.9437,75.751
Peru,2021-08-16,80,,82.4345,77.452
1 change: 1 addition & 0 deletions scripts/output/vaccinations/metadata/locations_age.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Lithuania,2021-08-13,European Centre for Disease Prevention and Control (ECDC),h
Luxembourg,2021-08-17,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Malta,2021-08-13,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Norway,2021-08-13,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Peru,2021-08-16,Ministerio de Salud via https://github.com/jmcastagnetto/covid-19-peru-vacunas,https://www.datosabiertos.gob.pe/dataset/vacunaci%C3%B3n-contra-covid-19-ministerio-de-salud-minsa
Poland,2021-08-17,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Portugal,2021-08-13,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Romania,2021-08-13,European Centre for Disease Prevention and Control (ECDC),https://www.ecdc.europa.eu/en/publications-data/data-covid-19-vaccination-eu-eea
Expand Down
32 changes: 32 additions & 0 deletions scripts/src/cowidev/vax/batch/peru.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import pandas as pd

from cowidev.vax.utils.dates import localdatenow
from cowidev.vax.utils.files import export_metadata


class Peru:
def __init__(self) -> None:
self.location = "Peru"
self.source_url = (
"https://github.com/jmcastagnetto/covid-19-peru-vacunas/raw/main/datos/vacunas_covid_resumen.csv"
)
self.source_url_age = (
"https://github.com/jmcastagnetto/covid-19-peru-vacunas/raw/main/datos/vacunas_covid_rangoedad_owid.csv"
)
self.source_url_ref = (
"https://www.datosabiertos.gob.pe/dataset/vacunaci%C3%B3n-contra-covid-19-ministerio-de-salud-minsa"
)
Expand All @@ -22,6 +28,9 @@ def read(self):
usecols=["fecha_vacunacion", "fabricante", "dosis", "n_reg"],
)

def read_age(self):
return pd.read_csv(self.source_url_age)

def pipe_rename_columns(self, df: pd.DataFrame) -> pd.DataFrame:
df = df.rename(columns={"fecha_vacunacion": "date", "fabricante": "vaccine"})
return df.dropna(subset=["vaccine"])
Expand Down Expand Up @@ -73,9 +82,32 @@ def pipeline(self, df: pd.DataFrame) -> pd.DataFrame:
.pipe(self.pipe_metadata)
)

def pipe_checks_age(self, df: pd.DataFrame) -> pd.DataFrame:
if (df.people_vaccinated_per_hundred > 100).sum():
raise ValueError("Check `people_vaccinated_per_hundred` field! Found values above 100%.")
if (df.people_fully_vaccinated_per_hundred > 100).sum():
raise ValueError("Check `people_fully_vaccinated_per_hundred` field! Found values above 100%.")
if (df.date.min() < "2021-02-08") or (df.date.max() > localdatenow("America/Lima")):
raise ValueError("Check `date` field! Some dates may be out of normal")
if not (df.location.unique() == "Peru").all():
raise ValueError("Invalid values in `location` field!")
return df

def pipeline_age(self, df: pd.DataFrame) -> pd.DataFrame:
return df.pipe(self.pipe_checks_age)

def export(self, paths):
df = self.read().pipe(self.pipeline)
df.to_csv(paths.tmp_vax_out(self.location), index=False)
# Age data
df_age = self.read_age().pipe(self.pipeline_age)
df_age.to_csv(paths.tmp_vax_out_by_age_group(self.location), index=False)
export_metadata(
df_age,
"Ministerio de Salud via https://github.com/jmcastagnetto/covid-19-peru-vacunas",
self.source_url_ref,
paths.tmp_vax_metadata_age,
)


def main(paths):
Expand Down

0 comments on commit 2a40909

Please sign in to comment.