Update app.py
Browse files
app.py
CHANGED
|
@@ -22,12 +22,42 @@ def run_validation(survey_file, uuid):
|
|
| 22 |
indicators_df = pd.read_excel(INDICATORS_PATH)
|
| 23 |
|
| 24 |
# Pass all inputs to your function (update name/args as needed)
|
| 25 |
-
#
|
| 26 |
indicator_df, questions_df, choice_df, data_all, raw_data, column_strategy_df = f.load_dataframes(
|
| 27 |
indicator_path,
|
| 28 |
questions_path,
|
| 29 |
choice_path,
|
| 30 |
survey_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Assume result is a DataFrame, can adjust to return Excel, text, etc.
|
| 32 |
return indicator_df, questions_df, choice_df, data_all, raw_data, column_strategy_df
|
| 33 |
|
|
|
|
| 22 |
indicators_df = pd.read_excel(INDICATORS_PATH)
|
| 23 |
|
| 24 |
# Pass all inputs to your function (update name/args as needed)
|
| 25 |
+
# parameters file
|
| 26 |
indicator_df, questions_df, choice_df, data_all, raw_data, column_strategy_df = f.load_dataframes(
|
| 27 |
indicator_path,
|
| 28 |
questions_path,
|
| 29 |
choice_path,
|
| 30 |
survey_path)
|
| 31 |
+
|
| 32 |
+
# consistency
|
| 33 |
+
table_1_1, table_1_2, table_1_3 = f.consistency_score_report(
|
| 34 |
+
raw_data=raw_data,
|
| 35 |
+
indicator_df=indicator_df,
|
| 36 |
+
questions_df=questions_df,
|
| 37 |
+
column_strategy_df=column_strategy_df,
|
| 38 |
+
data_all=data_all,
|
| 39 |
+
theme_list=theme_list
|
| 40 |
+
)
|
| 41 |
+
# integrity
|
| 42 |
+
table_2_1, table_2_2, table_2_3,table_2_4,table_2_5 = f.integrity_report(raw_data, questions_df, column_strategy_df, survey_type,table_1_2)
|
| 43 |
+
|
| 44 |
+
# representativity
|
| 45 |
+
if segmentation == 'yes':
|
| 46 |
+
table_3_1, table_3_2, table_3_3, table_3_4 = f.representativity_report(segmentation, raw_data, table_2_4, segmentation_columns, mapping_segmentation_quotas,
|
| 47 |
+
table_2_3, N, table_1_3)
|
| 48 |
+
else:
|
| 49 |
+
table_3_3, table_3_4 = f.representativity_report(segmentation, raw_data, table_2_4, segmentation_columns, mapping_segmentation_quotas,
|
| 50 |
+
table_2_3, N, table_1_3)
|
| 51 |
+
|
| 52 |
+
# enumerator bias
|
| 53 |
+
if 'enumerator_name' in raw_data.columns:
|
| 54 |
+
table_4_1, table_4_2 = f.enumerator_urgent_issues_report(raw_data, table_2_5)
|
| 55 |
+
else:
|
| 56 |
+
table_4_1 = []
|
| 57 |
+
table_4_2 = []
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
# Assume result is a DataFrame, can adjust to return Excel, text, etc.
|
| 62 |
return indicator_df, questions_df, choice_df, data_all, raw_data, column_strategy_df
|
| 63 |
|