Beispiel #1
0
def business(responses):
    questions = [
        "What is the type of business you operate?",
        "How confident are you about recovery in a post-lockdown scenario?",
        "What was your business status during the lockdown?",
        "Does your business fall under Essential services?",
        """Is your business registered under any sort of 
Government registration?""",
        "How would you rate your business performance prior to the lockdown, based on your expectation?",
        "What are the challenges you faced in business operations?",
        "What coping strategies do you plan on adopting for business recovery?",
        "What is the expected timeline for business recovery for you?",
        "Do you plan to apply for any government relief packages?",
    ]
    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_bar(responses, question))))
    return [make_jumbotron("Back to Overview", "/")
            ] + plot_list + footercontent
Beispiel #2
0
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_bar(responses, question))))
    return [make_jumbotron("Back to Overview", "/")] + plot_list
Beispiel #3
0
def household(responses):
    questions = [
        "Are you the sole earner for the household?",
        "What household challenges did you face during the lockdown?",
    ]
    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_bar(responses, question))))
    return [make_jumbotron("Back to Overview", "/")
            ] + plot_list + footercontent
Beispiel #4
0
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_bar(responses,
                                 question,
                                 barmode="stack",
                                 orientation="h"))))
    return [make_jumbotron("Back to Overview", "/")] + plot_list
Beispiel #5
0
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)",
        "What is the status of payments to suppliers this month?",
        "What do you expect in terms of payments to suppliers next month?",
        "Are you getting paid by your customers?",
        "Why do you think there has been a change in the 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",
        "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_bar(responses, question))))
    return [make_jumbotron("Back to Overview", "/")
            ] + plot_list + footercontent
Beispiel #6
0
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_bar(responses, question))))
    return [make_jumbotron("Back to Overview", "/")] + plot_list
Beispiel #7
0
def index(responses, summary_table):
    business_recovery_data_plot = make_question_pie(
        responses,
        "How confident are you about recovery in a post-lockdown scenario?")
    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_bar(
        responses,
        "What household challenges did you face during the lockdown?")
    row_style = {}

    return [
        dbc.Row(make_jumbotron("Explore", "/playground")),
        html.Div(
            children=[
                dbc.Row(style=row_style,
                        children=[
                            dbc.Col(children=[
                                html.H3("Overview"),
                                make_summary_table(responses, summary_table),
                                html.Br(),
                                html.Br(),
                            ],
                                    className="col-md-12")
                        ],
                        className=""),
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Business Recovery",
                                         href="business")),
                            html.Div(children=[
                                html.
                                P("""Most believe that it would take them four months or more to get their business back to pre-COVID levels. Despite a strong recovery sentiment, 46% of the respondents do not seem to have any coping strategy in place. Also 14% of the respondents who are confident of business recovery and plan to scale down their business significantly in order to cope with COVID-19 related losses. """,
                                  className="overview_txt"),
                                html.B("Insights: "),
                                html.Span(
                                    "Despite most businesses remaining closed during phase lockdown, 81% of the Entreprise owners seem to be somewhat confident(50%) to fully confident (31%) of business recovery in a post COVID-29 scenario.",
                                    className="overview_txt"),
                                html.
                                P(""" (Click on the title to dive deeper into the section)""",
                                  className="overview_italic"),
                            ],
                                     className="overbox"),
                            business_recovery_data_plot,
                            html.Div(
                                children=[
                                    html.H3("STORIES FROM THE FIELD"),
                                    html.Div(
                                        children=[
                                            html.Div(children=[
                                                html.Img(
                                                    src="/assets/business1.png",
                                                    className="voiceimg")
                                            ],
                                                     className="voiceleft"),
                                            html.Div(children=[
                                                html.
                                                Q("Everything is so uncertain that nothing can be said  about the future. But, we are taking this as a long term process. We have to get through 4 more months. Nothing can be normal this year, but surely from 2021, we will be back on track! "
                                                  ),
                                                html.
                                                P("Chandra, Karur District in Tamil Nadu"
                                                  ),
                                            ],
                                                     className="voicergt"),
                                        ],
                                        className="voicebluebox",
                                    ),
                                ],
                                className="voicebox",
                            ),
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6"),
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Cash flow and Credit",
                                         href="credit")),
                            html.Div(children=[
                                html.
                                P(""" Cashflow disruption due to low sales has been reported as the biggest challenge across most enterprises, also 72% have said their profits have decreased.""",
                                  className="overview_txt"),
                                html.B("Insights: "),
                                html.Span(
                                    "In the first round 57% of enterprises reported not having any cash reserves to survive. Further, 40% tried to borrow money to cover expenses. Of which, only 14% of the overall borrowing was from formal borrowing sources.",
                                    className="overview_txt"),
                                html.
                                P(""" (Click on the title to dive deeper into the section)""",
                                  className="overview_italic"),
                            ],
                                     className="overbox"),
                            cash_recovery_plot,
                            html.Div(
                                children=[
                                    html.H3("STORIES FROM THE FIELD"),
                                    html.Div(
                                        children=[
                                            html.Div(children=[
                                                html.Img(
                                                    src="/assets/cash11.png",
                                                    className="voiceimg")
                                            ],
                                                     className="voiceleft"),
                                            html.Div(children=[
                                                html.
                                                Q("I borrow money from friends for purchasing stocks and I’ve taken gold loans to pay the salaries and maintenance bills. My problem is only 20% of customers pay immediately and the remaining 80% people purchase all on credit "
                                                  ),
                                                html.
                                                P("  Small grocery business owner from Thiruvallur in Tamil Nadu. "
                                                  ),
                                            ],
                                                     className="voicergt"),
                                        ],
                                        className="voicebluebox",
                                    ),
                                ],
                                className="voicebox",
                            ),
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6")
                    ],
                    className="",
                ),

                # html.Hr(className="my-2"),
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(dcc.Link("Employment", href="employment")),
                            html.Div(children=[
                                html.
                                P("""Micro businesses are prone to economic fallouts in pandemics due to their non-regular employment and lack of contractual social protection. However, ‘goodwill and loyalty’ in the early months of the lockdown have emerged as the foundation for supporting workers in adverse times.""",
                                  className="overview_txt"),
                                html.B("Insights: "),
                                html.Span(
                                    "Interestingly, most of the respondents during our Month 1 Survey suggested that they have not laid off employees. 75% of the respondents said they did not lay off, while 13% suggested that they are not laying off but are unable to pay salaries.",
                                    className="overview_txt"),
                                html.
                                P(""" (Click on the title to dive deeper into the section)""",
                                  className="overview_italic"),
                            ],
                                     className="overbox"),
                            employment_plot,
                            html.Div(
                                children=[
                                    html.H3("STORIES FROM THE FIELD"),
                                    html.Div(
                                        children=[
                                            html.Div(children=[
                                                html.Img(
                                                    src="/assets/emp2.png",
                                                    className="voiceimg")
                                            ],
                                                     className="voiceleft"),
                                            html.Div(children=[
                                                html.
                                                Q("Despite this situation, laying off workers was not something I considered. Instead, I had a conversation with my workers about their preferences. Based on that discussion, I continue to pay 2 of my staff who were willing to come in to work and retained the others"
                                                  ),
                                                html.
                                                P("Vengadesh – Owner welding workshop in the small town of Tirunelveli in Tamil Nadu employs 7 people"
                                                  ),
                                            ],
                                                     className="voicergt"),
                                        ],
                                        className="voicebluebox",
                                    ),
                                ],
                                className="voicebox  vbtop",
                            ),
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6"),
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Household Challenges",
                                         href="household")),
                            html.Div(children=[
                                html.
                                P("""Across all respondents, Female business owners faced more household challenges than men. 70% female business owners suggested inter house conflicts as the biggest challenge during the lockdown. Women also have reported not being able to afford major household expenses than men.""",
                                  className="overview_txt"),
                                html.B("Insights: "),
                                html.Span(
                                    "53% of female respondents suggested that household chores were a priority for them during lockdown, while only 31% male listed the same as their priority task. At the same time, 15% males listed leisure activities as one of the tasks during lockdown, while none of the female counterparts suggested the same.",
                                    className="overview_txt"),
                                html.
                                P(""" (Click on the title to dive deeper into the section)""",
                                  className="overview_italic"),
                            ],
                                     className="overbox"),
                            household_plot,
                            html.Div(
                                children=[
                                    html.H3("STORIES FROM THE FIELD"),
                                    html.Div(
                                        children=[
                                            html.Div(children=[
                                                html.Img(
                                                    src="/assets/house3.png",
                                                    className="voiceimg")
                                            ],
                                                     className="voiceleft"),
                                            html.Div(children=[
                                                html.
                                                Q("Being a female, even life prior to lockdown was tough as domestic responsibilities are definitely a priority. I recall the struggle to convince my husband to let me start my own cloth bag business. Now when I employ 13 women and have trained 4000 women, he has started to support me in training and expanding more as he sees I'm doing well financially. Though, managing business is always interrupted by necessity to deal with household chores, so I wake up early at 5am to ensure I manage all domestic duties and then head to my shop at 9am. "
                                                  ),
                                                html.
                                                P("Vidya Kirve, Satara Branch, Maharashtra"
                                                  ),
                                            ],
                                                     className="voicergt"),
                                        ],
                                        className="voicebluebox",
                                    ),
                                ],
                                className="voicebox",
                            ),
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6")
                    ],
                ),
            ],
            className="container overviewpage",
        ),
        html.Div(children=[
            html.Div(children=[
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(
                                "Survey Methodology", className="text-center"),
                            html.
                            P("""Our stratified, convenience sample was drawn from various sub-industries in manufacturing, services and trade to provide a sectoral representation of microbusinesses. The sample was selected from lists provided by partner organizations. The following regions and states will be covered in the survey: North India (Delhi, Haryana, Punjab, Uttar Pradesh), South India (Tamil Nadu), West India (Gujarat, Maharashtra, Rajasthan). The surveys were conducted telephonically in the area’s local language, and each survey took 18-25 minutes to administer.""",
                              className="survey_txt"),
                        ],
                                className="paddzero"),
                    ],
                    className=""),
            ],
                     className="container paddzero"),
        ],
                 className="overviewpage"),
    ] + footercontent
Beispiel #8
0
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 have?")
    employment_plot = make_question_pie(responses, "Were employees laid off?")
    household_plot = make_bar(
        responses,
        "Challenges in the household during lockdown (multiple choice)")
    row_style = {}

    return [
        dbc.Row(make_jumbotron("Explore", "/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("Household Challenges",
                                     href="household")),
                    household_plot,
                ])
            ],
            className="houseview",
        ),
    ]
Beispiel #9
0
def make_charts_for_questions(
    responses,
    data,
    questions,
    state_filter,
    gender_filter,
    industry_filter,
    breakdown,
    label_questions,
):
    breakdown_to_name = {
        "Industry": "TypeofIndustry",
        "Gender": label_questions["Split of Business ownership by Gender"],
        "Essential/Non Essential": "our cat"
    }
    #print(label_questions)
    children = []
    for question in questions:
        #print(question)
        label = label_questions[question]
        if label == 'f3':
            fig = make_bar(responses, question)
            children.append(dbc.Row(dbc.Col(children=[fig])))
        if label in data:
            #print(label)
            filtered_df = data
            if state_filter:
                filtered_df = filtered_df[filtered_df["State"].isin(
                    state_filter)]
            if gender_filter:
                filtered_df = filtered_df[filtered_df[
                    label_questions["Split of Business ownership by Gender"]].
                                          isin(gender_filter)]
            if industry_filter:
                filtered_df = filtered_df[filtered_df["TypeofIndustry"].isin(
                    industry_filter)]
            if breakdown:
                data_list = []
                unique_vals = filtered_df[
                    breakdown_to_name[breakdown]].unique()
                for i, un in enumerate(unique_vals):
                    freqs = filtered_df[filtered_df[
                        breakdown_to_name[breakdown]] == un][
                            data[label].notna()][label].value_counts()
                    columns = list(freqs.index)
                    values = freqs.to_numpy()
                    vsum = values.sum()
                    vsum = vsum if vsum else 1.0
                    raw_resp = list(values)
                    raw_resp = ["%d" % x for x in raw_resp]
                    values = [x / vsum * 100. for x in values]
                    t = ["%0.2f %%" % x for x in values]
                    data_list.append({
                        "x": columns,
                        "y": values,
                        "type": "bar",
                        "name": un,
                        "hovertext": raw_resp,
                        "hoverinfo": "text",
                        "text": t,
                        "textposition": "auto",
                        "marker": {
                            "color": colors[i]
                        }
                    })
                fig = dcc.Graph(id=label,
                                figure={
                                    "data": data_list,
                                    "layout": {
                                        "title": {
                                            "text": question
                                        },
                                        "barmode": "group",
                                        "yaxis": {
                                            "title": "% of Responses"
                                        },
                                        "xaxis": {
                                            "automargin": True
                                        }
                                    },
                                },
                                config={
                                    'modeBarButtonsToRemove': [
                                        'toggleSpikelines', 'autoScale2d',
                                        'pan2d', 'zoom2d', 'select2d',
                                        'lasso2d', 'hoverClosestGl2d',
                                        'resetScale2d', 'toggleHover',
                                        'hoverClosestCartesian',
                                        'hoverCompareCartesian'
                                    ]
                                })
                children.append(dbc.Row(dbc.Col(children=[fig])))
            else:
                freqs = filtered_df[data[label].notna()][label].value_counts()
                columns = list(freqs.index)
                values = freqs.to_numpy()
                raw_resp = list(values)
                raw_resp = ["%d" % x for x in raw_resp]
                vsum = values.sum()
                vsum = vsum if vsum else 1.0
                values = [x / vsum * 100. for x in values]
                t = ["%0.2f %%" % x for x in values]
                fig = dcc.Graph(id=label,
                                figure={
                                    "data": [{
                                        "x": columns,
                                        "y": values,
                                        "type": "bar",
                                        "name": "Responses",
                                        "marker": {
                                            "color": colors
                                        },
                                        "hovertext": raw_resp,
                                        "hoverinfo": "text",
                                        "text": t,
                                        "textposition": "auto",
                                    }],
                                    "layout": {
                                        "title": question,
                                        "yaxis": {
                                            "title": "% of Responses"
                                        },
                                        "xaxis": {
                                            "automargin": True
                                        }
                                    },
                                },
                                config={
                                    'modeBarButtonsToRemove': [
                                        'toggleSpikelines', 'autoScale2d',
                                        'pan2d', 'zoom2d', 'select2d',
                                        'lasso2d', 'hoverClosestGl2d',
                                        'resetScale2d', 'toggleHover',
                                        'hoverClosestCartesian',
                                        'hoverCompareCartesian'
                                    ]
                                })
                children.append(dbc.Row(dbc.Col(children=[fig])))
    return children
Beispiel #10
0
def index(responses, summary_table):
    business_recovery_data_plot = make_question_pie(
        responses,
        "How confident are you about recovery in a post-lockdown scenario?")
    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_bar(
        responses,
        "What household challenges did you face during the lockdown?")
    row_style = {}

    return [
        dbc.Row(make_jumbotron("Explore", "/playground")),
        html.Div(
            children=[
                dbc.Row(style=row_style,
                        children=[
                            dbc.Col(children=[
                                html.H3("Overview"),
                                make_summary_table(responses, summary_table),
                                html.Br(),
                                html.Br(),
                            ],
                                    className="col-md-12")
                        ],
                        className=""),
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Business Recovery",
                                         href="business")),
                            html.
                            P("""Despite most businesses remaining closed during lockdown, 81% of the respondents suggested that they are confident of business recovery in a post COVID-29 scenario.
""",
                              className="overview_txt"),
                            html.
                            P(""" (Click on the title to dive deeper into the section)""",
                              className="overview_italic"),
                            business_recovery_data_plot,
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6"),
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Credit/Loans/Financial Status",
                                         href="credit")),
                            html.
                            P("""57% reported not having any cash reserves to survive. Further, 40% tried to borrow money to cover expenses. Only 14% of the overall borrowing was from formal borrowing sources.""",
                              className="overview_txt"),
                            html.
                            P(""" (Click on the title to dive deeper into the section)""",
                              className="overview_italic"),
                            cash_recovery_plot,
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6")
                    ],
                    className="",
                ),

                # html.Hr(className="my-2"),
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(dcc.Link("Employment", href="employment")),
                            html.
                            P("""Interestingly, most of the respondents during our Month 1 Survey suggested that they have not laid off employees. 79% of the respondents said they did not lay off, while 13% suggested that they are not laying off but are unable to pay salaries.
""",
                              className="overview_txt"),
                            html.
                            P(""" (Click on the title to dive deeper into the section)""",
                              className="overview_italic"),
                            employment_plot,
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6"),
                        dbc.Col(children=[
                            html.H3(
                                dcc.Link("Household Challenges",
                                         href="household")),
                            html.
                            P("""Across all respondents, Female business owners faced more household challenges than men. 70% female business owners suggested inter house conflicts as the biggest challenge while 53% men responded to the same. Women also faced more unaffordable expenses than men, with 46% suggesting the same.
""",
                              className="overview_txt"),
                            html.
                            P(""" (Click on the title to dive deeper into the section)""",
                              className="overview_italic"),
                            household_plot,
                        ],
                                className="col-xs-12 col-sm-12 col-lg-6")
                    ],
                ),
            ],
            className="container overviewpage",
        ),
        html.Div(children=[
            html.Div(children=[
                dbc.Row(
                    style=row_style,
                    children=[
                        dbc.Col(children=[
                            html.H3(
                                "Survey Methodology", className="text-center"),
                            html.
                            P("""Our stratified, convenience sample was drawn from various sub-industries in manufacturing, services and trade to provide a sectoral representation of microbusinesses. The sample was selected from lists provided by partner organizations. The following regions and states will be covered in the survey: North India (Delhi, Haryana, Punjab, Uttar Pradesh), South India (Tamil Nadu), West India (Gujarat, Maharashtra, Rajasthan). The surveys were conducted telephonically in the area’s local language, and each survey took 18-25 minutes to administer.""",
                              className="survey_txt"),
                        ],
                                className="paddzero"),
                    ],
                    className=""),
            ],
                     className="container paddzero"),
        ],
                 className="overviewpage"),
    ] + footercontent