From 71f5ba67d24037b1a3214c30aca7e265a2b999b2 Mon Sep 17 00:00:00 2001 From: Nathan Kelly Date: Thu, 9 Jan 2025 16:38:02 +0000 Subject: [PATCH] Add in adjustedresponse as imputation_value and update test data --- mbs_results/outputs/pivot_imputation_value.py | 3 ++ .../create_imputation_link_column_input.csv | 29 ++++++++++--------- .../create_imputation_link_column_output.csv | 26 ++++++++--------- .../format_imputation_link_input.csv | 26 ++++++++--------- .../format_imputation_link_output.csv | 24 +++++++-------- 5 files changed, 57 insertions(+), 51 deletions(-) diff --git a/mbs_results/outputs/pivot_imputation_value.py b/mbs_results/outputs/pivot_imputation_value.py index d9e5743..90434b2 100644 --- a/mbs_results/outputs/pivot_imputation_value.py +++ b/mbs_results/outputs/pivot_imputation_value.py @@ -166,6 +166,7 @@ def format_imputation_link(df): "imputation_link", "imputation_flags_adjustedresponse", "count_imps", + "adjustedresponse" ] ] @@ -176,7 +177,9 @@ def format_imputation_link(df): "questioncode": "Question", "imputation_flags_adjustedresponse": "link_type", "count_imps": "Count_imps", + "adjustedresponse": "Imputation_value" } ) return renamed_df + \ No newline at end of file diff --git a/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_input.csv b/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_input.csv index aa00086..0653ce6 100755 --- a/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_input.csv +++ b/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_input.csv @@ -1,13 +1,16 @@ -questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,imputation_link -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fic,1 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,0.65423421 -3,500,500,30000,500,1,0,1.3454653,100.2130214,bir,1.3454653 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,bir,1.23214 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,0.65423421 -3,500,500,30000,500,1,0,1.3454653,100.2130214,fir,1 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,c,4.123034 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,10.23466432 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fimc,1 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,0.65423421 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,mc, -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc, +questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,adjustedresponse +4,600,600,40000,250,1,1.424345,1.23214,4.123034,fic,100 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,200 +3,500,500,30000,500,1,0,1.3454653,100.2130214,bir,300 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,bir,100 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,200 +3,500,500,30000,500,1,0,1.3454653,100.2130214,fir,300 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,c,100 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,200 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,fimc,300 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,100 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,mc,200 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc,300 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,r,100 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,,200 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,r,300 diff --git a/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_output.csv b/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_output.csv index aa00086..8eca1f5 100755 --- a/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_output.csv +++ b/tests/data/outputs/pivot_imputation_value/create_imputation_link_column_output.csv @@ -1,13 +1,13 @@ -questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,imputation_link -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fic,1 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,0.65423421 -3,500,500,30000,500,1,0,1.3454653,100.2130214,bir,1.3454653 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,bir,1.23214 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,0.65423421 -3,500,500,30000,500,1,0,1.3454653,100.2130214,fir,1 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,c,4.123034 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,10.23466432 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fimc,1 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,0.65423421 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,mc, -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc, +questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,adjustedresponse,imputation_link +4,600,600,40000,250,1.0,1.424345,1.23214,4.123034,fic,100,1.0 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,200,0.65423421 +3,500,500,30000,500,1.0,0.0,1.3454653,100.2130214,bir,300,1.3454653 +4,600,600,40000,250,1.0,1.424345,1.23214,4.123034,bir,100,1.23214 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,200,0.65423421 +3,500,500,30000,500,1.0,0.0,1.3454653,100.2130214,fir,300,1.0 +4,600,600,40000,250,1.0,1.424345,1.23214,4.123034,c,100,4.123034 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,200,10.23466432 +4,600,600,40000,250,1.0,1.424345,1.23214,4.123034,fimc,300,1.0 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,100,0.65423421 +4,600,600,40000,250,1.0,1.424345,1.23214,4.123034,mc,200, +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc,300, diff --git a/tests/data/outputs/pivot_imputation_value/format_imputation_link_input.csv b/tests/data/outputs/pivot_imputation_value/format_imputation_link_input.csv index 64a305d..fda93eb 100755 --- a/tests/data/outputs/pivot_imputation_value/format_imputation_link_input.csv +++ b/tests/data/outputs/pivot_imputation_value/format_imputation_link_input.csv @@ -1,13 +1,13 @@ -questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,imputation_link,count_imps -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fic,1,5 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,0.65423421,5 -3,500,500,30000,500,1,0,1.3454653,100.2130214,bir,1.3454653,2 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,bir,1.23214,5 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,0.65423421,5 -3,500,500,30000,500,1,0,1.3454653,100.2130214,fir,1,2 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,c,4.123034,5 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,10.23466432,5 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,fimc,1,5 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,0.65423421,5 -4,600,600,40000,250,1,1.424345,1.23214,4.123034,mc,,5 -5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc,,5 +questioncode,cellnumber,cell_no,frosic2007,imputation_class,f_link_adjustedresponse,f_match_adjustedresponse_pair_count,b_link_adjustedresponse,construction_link,imputation_flags_adjustedresponse,adjustedresponse,imputation_link,count_imps +4,600,600,40000,250,1,1.424345,1.23214,4.123034,fic,100,1,5 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fic,200,0.65423421,5 +3,500,500,30000,500,1,0,1.3454653,100.2130214,bir,300,1.3454653,2 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,bir,100,1.23214,5 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fir,200,0.65423421,5 +3,500,500,30000,500,1,0,1.3454653,100.2130214,fir,300,1,2 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,c,100,4.123034,5 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,c,200,10.23466432,5 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,fimc,300,1,5 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,fimc,100,0.65423421,5 +4,600,600,40000,250,1,1.424345,1.23214,4.123034,mc,200,,5 +5,700,700,50000,100,0.65423421,0.8532432,0.7504535,10.23466432,mc,300,,5 diff --git a/tests/data/outputs/pivot_imputation_value/format_imputation_link_output.csv b/tests/data/outputs/pivot_imputation_value/format_imputation_link_output.csv index 7db017c..4b78cf5 100755 --- a/tests/data/outputs/pivot_imputation_value/format_imputation_link_output.csv +++ b/tests/data/outputs/pivot_imputation_value/format_imputation_link_output.csv @@ -1,13 +1,13 @@ sic,cell,Question,imputation_link,link_type,Count_imps,Imputation_value -40000,600,4,1,fic,5, -50000,700,5,0.65423421,fic,5, -30000,500,3,1.3454653,bir,2, -40000,600,4,1.23214,bir,5, -50000,700,5,0.65423421,fir,5, -30000,500,3,1,fir,2, -40000,600,4,4.123034,c,5, -50000,700,5,10.23466432,c,5, -40000,600,4,1,fimc,5, -50000,700,5,0.65423421,fimc,5, -40000,600,4,,mc,5, -50000,700,5,,mc,5, +40000,600,4,1.0,fic,5,100 +50000,700,5,0.65423421,fic,5,200 +30000,500,3,1.3454653,bir,2,300 +40000,600,4,1.23214,bir,5,100 +50000,700,5,0.65423421,fir,5,200 +30000,500,3,1.0,fir,2,300 +40000,600,4,4.123034,c,5,100 +50000,700,5,10.23466432,c,5,200 +40000,600,4,1.0,fimc,5,300 +50000,700,5,0.65423421,fimc,5,100 +40000,600,4,,mc,5,200 +50000,700,5,,mc,5,300