Skip to content

Commit

Permalink
Exclude serodata before first reported death
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-ragonnet committed Jul 27, 2023
1 parent 6d8674f commit 7f8a9d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ national_sero:
ECU: Ecuador
EGY: Egypt
ESP: Spain
EST: Estonia
ETH: Ethiopia
FRA: France
GBR: United Kingdom
HND: Honduras
Expand All @@ -247,7 +245,6 @@ national_sero:
LBN: Lebanon
LTU: Lithuania
MEX: Mexico
MNG: Mongolia
MWI: Malawi
NGA: Nigeria
NOR: Norway
Expand Down
4 changes: 2 additions & 2 deletions data/inputs/school-closure/serodata_national.csv
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
"outputs": [],
"source": [
"# Remove estimates where vaccine coverage is too high at the time\n",
"# and when survey date is before first reported death\n",
"max_vacc_seroprev_ratio = .10\n",
"\n",
"from datetime import datetime\n",
Expand All @@ -331,14 +332,19 @@
"\n",
"filtered_sero_data_national[\"low_vaccination\"] = [None] * len(filtered_sero_data_national)\n",
"\n",
"vcc = []\n",
"for idx in filtered_sero_data_national.index:\n",
" iso3 = filtered_sero_data_national.loc[idx, 'alpha_3_code']\n",
" seroprev = filtered_sero_data_national.loc[idx, 'serum_pos_prevalence']\n",
" \n",
" start_date = datetime.fromisoformat(filtered_sero_data_national.loc[idx, 'sampling_start_date'])\n",
" end_date = datetime.fromisoformat(filtered_sero_data_national.loc[idx, 'sampling_end_date'])\n",
" midpoint = start_date + (end_date - start_date) / 2 \n",
"\n",
" first_date_with_death = pd.to_datetime(owid_data[(owid_data[\"iso_code\"] == iso3) & (owid_data[\"new_deaths\"] > 0.)]['date']).min()\n",
" if midpoint <= first_date_with_death:\n",
" print()\n",
" filtered_sero_data_national.loc[idx, \"low_vaccination\"] = False\n",
"\n",
" if len(vacc_data[(vacc_data[\"iso_code\"] == iso3) & (vacc_data[\"date\"] >= midpoint)]) == 0:\n",
" filtered_sero_data_national.loc[idx, \"low_vaccination\"] = False\n",
" else:\n",
Expand Down

0 comments on commit 7f8a9d2

Please sign in to comment.