def business(responses): questions = [ "Business Type", "Confidence in business recovery", "Business Status During Lockdown", "Category of Business", "Business Registration", "Business performance compared expectation in a no-lockdown scenario", "Challenges in operation", "Coping strategies adopted (multiple choice)", "Expected time of business recovery", "Intention to apply for relief", ] plot_types = [ "pie", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar" ] plot_list = [] for question, plot_type in zip(questions, plot_types): if plot_type == "pie": plot_list.append( dbc.Row(dbc.Col(make_question_pie(responses, question)))) if plot_type == "bar": plot_list.append( dbc.Row(dbc.Col(make_household_multi(responses, question)))) return [make_jumbotron("Back to Overview", "/")] + plot_list
def employment(responses): questions = ["Were employees laid off?"] plot_types = ["bar"] plot_list = [] for question, plot_type in zip(questions, plot_types): if plot_type == "pie": plot_list.append(dbc.Row(dbc.Col(make_question_pie(responses, question)))) if plot_type == "bar": plot_list.append( dbc.Row(dbc.Col(make_household_multi(responses, question))) ) return [make_jumbotron("Back to Overview", "/")] + plot_list
def household(responses): questions = [ "Are you the sole earner for the household?", "Challenges in the household during lockdown (multiple choice)", ] plot_types = ["bar", "bar"] plot_list = [] for question, plot_type in zip(questions, plot_types): if plot_type == "pie": plot_list.append(dbc.Row(dbc.Col(make_question_pie(responses, question)))) if plot_type == "bar": plot_list.append( dbc.Row(dbc.Col(make_household_multi(responses, question))) ) return [make_jumbotron("Back to Overview", "/")] + plot_list
def credit(responses): questions = [ "How much cash reserves do you currently have?", "Did you dip into your savings", "Did you postpone any loan repayment due to cash crunch?", "Did you try borrowing to cover expenses?", "Were you able to secure a loan?", "Where did you get the loan from? (multiple choice)", "Payment to suppliers this month", "Payment to suppliers next month", "Are you getting paid by your customers", "Use of digital payments", "How long have you been using these digital payments for your business?", "Overall, how do you think your usage of digital payments has changed during the lockdown?", "For what purposes has your usage of digital payments changed during the lockdown?", "Why do you think there has been a change in the use of digital payments?", ] plot_types = [ "bar", "bar", "pie", "bar", "bar", "bar", "bar", "bar", "bar", "pie", "pie", "pie", "pie", "pie", ] plot_list = [] for question, plot_type in zip(questions, plot_types): if plot_type == "pie": plot_list.append(dbc.Row(dbc.Col(make_question_pie(responses, question)))) if plot_type == "bar": plot_list.append( dbc.Row(dbc.Col(make_household_multi(responses, question))) ) return [make_jumbotron("Back to Overview", "/")] + plot_list
def index(responses, summary_table): business_recovery_data_plot = make_question_pie( responses, "Confidence in business recovery" ) cash_recovery_plot = make_question_pie( responses, "How much cash reserves do you currently have?" ) employment_plot = make_question_pie(responses, "Were employees laid off?") household_plot = make_household_multi( responses, "Challenges in the household during lockdown (multiple choice)" ) row_style = { } return [ dbc.Row(make_jumbotron("View the Playground", "/playground")), dbc.Row( html.H3("Overview"), className ="overview" ), dbc.Row( className ="overviewtbl", children=[dbc.Col(make_summary_table(responses, summary_table))], ), dbc.Row( style=row_style, children=[ dbc.Col( children=[ html.H3(dcc.Link("Business Recovery", href="business")), business_recovery_data_plot, ], ) ], className ="businview", ), #html.Hr(className="my-2"), dbc.Row( style=row_style, children=[ dbc.Col( children=[ html.H3( dcc.Link("Credit/Loans/Financial Status", href="credit") ), cash_recovery_plot, ], ) ], className ="finview", ), #html.Hr(className="my-2"), dbc.Row( style=row_style, children=[ dbc.Col( children=[ html.H3(dcc.Link("Employment", href="employment")), employment_plot, ], ) ], className ="empview", ), #html.Hr(className="my-2"), dbc.Row( style=row_style, children=[ dbc.Col( children=[ html.H3(dcc.Link("Houeshold Challenges", href="household")), household_plot, ], ) ], className ="houseview", ), ]