UBC-MDS/Mental-Health-in-Tech-Dashboard

Visualization ideas for discussion during meeting

Closed this issue · 1 comments

Here is an example visualization I came up with to analyze the responses to the survey questions "If you have a mental health issue, do you feel that it interferes with your work when being treated effectively?" and "If you have a mental health issue, do you feel that it interferes with your work when NOT being treated effectively?"

Screenshot from 2021-01-20 21-34-16

The idea is that we would pass some global data from our dash app to the function which generates these plots and that when a user makes different selections on the dropdown widgets/radio buttons, the global data gets updated and so does the plot.

def plot_work_interfere_bars(global_data): 
    # my understanding is the global_data parameter will not be needed in the dash app
    plot_data = global_data.query('work_interfere_treated != "Not applicable to me" & work_interfere_not_treated != "Not applicable to me"')
    
    treated = alt.Chart(plot_data, title='When Treated').mark_bar(
    ).encode(x=alt.X('work_interfere_treated', sort=['Never', 'Rarely', 'Sometimes', 'Often'], axis=alt.Axis(title='')),
             y=alt.Y('count()', axis=alt.Axis(title='Number of Responses'))
    ).properties(height=200, width=200)
    
    untreated = alt.Chart(plot_data, title='When Untreated').mark_bar(
    ).encode(x=alt.X('work_interfere_not_treated', sort=['Never', 'Rarely', 'Sometimes', 'Often'], axis=alt.Axis(title='')), 
             y=alt.Y('count()', axis=alt.Axis(title='Number of Responses'))
    ).properties(height=200, width=200)
    
    viz = alt.hconcat(treated, untreated, title='Does your mental health issue interfere with your work?'
    ).configure_title(fontSize=20, font='Courier', anchor='middle', color='gray')
    return viz#.to_html()
d-sel commented

That's great! I like the plot, @mikelynch416!

I came up with a plot that specifies responses by gender. The idea is that the user could select between different questions and see if there are differences between responses based on gender.

I did some 'data clean up' in the processing file because there were many different responses, which I will merge with a PR when we finalize the plots we would like to use.

visualization (1)

or an alternative:
visualization (2)