def test_header_fail(mock_st, param): """ Just proving to myself that these tests work """ some_garbage = "ajskhlaeHFPIQONOI8QH34TRNAOP8ESYAW4" display_header(mock_st, param) assert len(list(filter(lambda s: some_garbage in s, mock_st.render_store))), "This should fail"
additional_projections_chart, admitted_patients_chart, new_admissions_chart, chart_descriptions ) # This is somewhat dangerous: # Hide the main menu with "Rerun", "run on Save", "clear cache", and "record a screencast" # This should not be hidden in prod, but removed # In dev, this should be shown st.markdown(hide_menu_style, unsafe_allow_html=True) p = display_sidebar(st, DEFAULTS) m = SimSirModel(p) display_header(st, m, p) if st.checkbox("Show more info about this tool"): notes = "The total size of the susceptible population will be the entire catchment area for Penn Medicine entities (HUP, PAH, PMC, CCH)" show_more_info_about_this_tool(st=st, model=m, parameters=p, defaults=DEFAULTS, notes=notes) st.subheader("New Admissions") st.markdown("Projected number of **daily** COVID-19 admissions at Penn hospitals") new_admit_chart = new_admissions_chart(alt, m.admits_df, parameters=p) st.altair_chart( new_admissions_chart(alt, m.admits_df, parameters=p), use_container_width=True, ) st.markdown(chart_descriptions(new_admit_chart, p.labels))
hospitalized_los), icu=RateLos(icu_rate, icu_los), ventilated=RateLos(ventilated_rate, ventilated_los)) p = display_sidebar(st, DEFAULTS) # PRESENTATION display_header( st, total_infections=p.infected, initial_infections=p.known_infected, detection_prob=p.detection_probability, current_hosp=p.current_hospitalized, hosp_rate=p.hospitalized.rate, S=p.susceptible, market_share=p.market_share, recovery_days=p.recovery_days, r_naught=p.r_naught, doubling_time=p.doubling_time, relative_contact_rate=p.relative_contact_rate, r_t=p.r_t, doubling_time_t=p.doubling_time_t, ) if st.checkbox("Show more info about this tool"): notes = "The total size of the susceptible population will be the entire catchment area for Penn Medicine entities (HUP, PAH, PMC, CCH)" show_more_info_about_this_tool( st=st, recovery_days=p.recovery_days, doubling_time=p.doubling_time, r_naught=p.r_naught, relative_contact_rate=p.relative_contact_rate,
def test_penn_logo_in_header(): penn_css = '<link rel="stylesheet" href="https://www1.pennmedicine.org/styles/shared/penn-medicine-header.css">' display_header(st, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) assert len( list(filter(lambda s: penn_css in s, st.render_store)) ), "The Penn Medicine header should be printed"
def header_test_helper(expected_str, model, param, mock_st): display_header(mock_st, model, param) assert [s for s in mock_st.render_store if expected_str in s ], f"Expected the string '{expected_str}' in the display header"