Package: vacheck
vacheckData consistency checks for verbal autopsy (VA) data collected using the WHO
VA instrument.>>>fromvacheck.datacheck5importdatacheck5,get_example_input>>>input=get_example_input()>>>input.head<boundmethodNDFrame.headofIDi004ai004bi019ai019bi022ai022bi022ci022di022e...i450oi451oi452oi453oi454oi455oi456oi457oi458oi459o0d1NaNNaN1.0NaN1.0NaNNaN00...00000000001d2NaNNaNNaN1.01.0NaNNaN00...00000000002d3NaNNaN1.0NaNNaN1.0NaN00...00000000003d4NaNNaNNaN1.0NaNNaN1.000...00000000004d5NaNNaN1.0NaNNaNNaN1.000...0000000000.................................................................195d196NaNNaNNaN1.0NaNNaN1.000...0000000000196d197NaNNaN1.0NaN1.0NaNNaN00...0000000000197d198NaNNaN1.0NaN1.0NaNNaN00...0000000000198d199NaNNaNNaN1.01.0NaNNaN00...0000000000199d200NaNNaNNaN1.01.0NaNNaN00...0000000000[200rowsx354columns]>>>>pb=get_probbase()>>>checked_input=datacheck5(va_input=input.iloc[0],va_id=input.at[0,"ID"],probbase=pb)>>>checked_input.get("output")IDd1i004aNaNi004bNaNi019a1.0i019bNaN...i455o0i456o0i457o0i458o0i459o0Name:0,Length:354,dtype:object>>>checked_input.get("first_pass")[0]'d1   W610104-o (ever cry) only required for neonates - cleared in working information'>>>checked_input.get("second_pass")[]>>># run checks on entire DataFrame (takes a few seconds for 200 records)>>>check_all=input.apply(lambdax:datacheck5(x,x.ID,probbase=pb)["output"],axis=1)>>>check_allIDi004ai004bi019ai019bi022ai022bi022ci022di022e...i450oi451oi452oi453oi454oi455oi456oi457oi458oi459o0d1NaNNaN1.0NaN1.0NaNNaN00...00000000001d2NaNNaNNaN1.01.0NaNNaN00...00000000002d3NaNNaN1.0NaNNaN1.0NaN00...00000000003d4NaNNaNNaN1.0NaNNaN1.000...00000000004d5NaNNaN1.0NaNNaNNaN1.000...0000000000.................................................................195d196NaNNaNNaN1.0NaNNaN1.000...0000000000196d197NaNNaN1.0NaN1.0NaNNaN00...0000000000197d198NaNNaN1.0NaN1.0NaNNaN00...0000000000198d199NaNNaNNaN1.01.0NaNNaN00...0000000000199d200NaNNaNNaN1.01.0NaNNaN00...0000000000[200rowsx354columns]DetailsWith the development of theInterVAalgorithm,
several data consistency checks were designed to ensure that indicators and
symptoms do not indicate conflicting information (e.g., male and pregnant).For example, the following are inconsistent:ageInDays: 10 daysHow long did (s)he have a cough: 4 weeksThe data checks try to reconcile inconsistencies like these.  In the original
software the data checks were defined inprobbase.xls(the symptom-cause-information matrix with the conditional probabilities of
each symptom given a cause -- see below for more information on the SCI,
and theInterVA User's Guide).Each type of consistency check is performed for each VA record, and then the
process is repeated a second time.Before the consistency checks are run, any VA record with missing information
on age or sex are removed -- these indicators are necessary for running the
InterVA and InSilicoVA algorithms.How each data check is performedThere are 3 types of data consistency checksDon't askNecessary Conditions(for inconsistency)both symptoms have non-missing valuesindex symptom == (Y or N) value insubstprobbase columnsymptom in thedontaskXprobbase column == last character
(Y or N) in that cell(dontaskXranges fromdontask1todontask8)Action: index symptom is set to missingthe log message is "(don't ask symptom) cleared in working information"Ask ifNecessary Conditionsthe index symptom == (Y or N) value in thesubstprobbase
column (and thus not a missing value)the symptom listed in thedoaskifprobbase columndoes notequal
the last character in that cellAction: assign the symptom listed in thedoaskifto the last
character (Y or N) in that cell (concatenated to the symptom label,
e.g.,i022cY)the log message is "(ask if symptom label) updated in working information"Neonates onlyNecessary Conditionsindex symptom == (Y or N) value in thesubstprobbase column
(and thus index symptom does not have a missing value)the decedent was NOT a neonateAction: assign the index symptom to missingthe log message is "(index symptom) only required for neonates - cleared
in working information"probbaseRelevant columns inprobbase.xlsindic(column A)subst(column F)dontask1 - dontask8(columns H - O)doaskif(column P)nnonly(column Q)>>>fromvacheck.datacheck5importget_probbase>>>probbase=get_probbase(keep_nan=True,keep_qdesc=True)>>>probbase.iat[0,2]'probbase v18 20200403 '>>>probbase.columnsIndex(['indic','qdesc','sdesc','who_2016','ilab','subst','samb','dontask1','dontask2','dontask3','dontask4','dontask5','dontask6','dontask7','dontask8','doaskif','nnonly','a_nrp','a_pend_6w','a_preg','b_0101','b_0102','b_0103','b_0104','b_0105','b_0106','b_0107','b_0108','b_0109','b_0110','b_0111','b_0112','b_0199','b_0201','b_0202','b_0203','b_0204','b_0205','b_0299','b_0301','b_0302','b_0303','b_0401','b_0402','b_0403','b_0499','b_0501','b_0502','b_0601','b_0602','b_0701','b_0801','b_0901','b_0902','b_0903','b_0904','b_0905','b_0906','b_0907','b_0908','b_0999','b_1001','b_1002','b_1003','b_1004','b_1006','b_1099','b_1101','b_1102','b_1201','b_1202','b_1203','b_1204','b_1205','b_1206','b_1207','b_1208','b_1209','b_1210','b_1299','b_9800','c_cult','c_emer','c_hsys','c_inev','c_know','c_resr'],dtype='object')>>>probbase[["indic","subst","dontask1","dontask8","doaskif","nnonly"]]indicsubstdontask1dontask8doaskifnnonly1priorNaNNaNNaNNaNNaN2i004aYi004bYNaNNaNNaN3i004bYi004aYNaNNaNNaN4i019aYi019bYNaNNaNNaN5i019bYi019aYNaNNaNNaN....................350i455oYNaNNaNNaNNaN351i456oYNaNNaNNaNNaN352i457oYNaNNaNNaNNaN353i458oNNaNNaNNaNNaN354i459oYNaNNaNNaNNaN[354rowsx6columns]ExamplesDon't askLog message: "4 W610059-o (married) value inconsistent with W610022-a (65+) -
cleared in working information"VA record ID is 4i059o- Was she married at the time of death? (withsubst == Y)i022a- Was s(he) aged 65 years or more at death?dontask6-i022aY(don't ask item for index symptomi059oifi022a == Y)action:i059ais changed (in the working copy of the data) from
Y to missingAsk IfLog message: "7 W610152-o (fev nsw) not flagged in category W610147-o
(fever) - updated in working information"VA record ID is 7i152o- Did (s)he have night sweats? (withsubst == Y)i147o- During the illness that led to death, did (s)he have a fever?doaskif- do aski152oifi147o == Yactioni147ois changed from missing to YNeonates onlyLog message: "103075 W610394-a (born 1st pr) only required for neonates -
cleared in working information"VA record ID is 103075i394a- Was this baby born from the mother's first pregnancy?VA record was not a neonatal deathactioni394ais set to missing