Skip to content

Commit b41cf5c

Browse files
committed
adds jan 26 ukprn lookups
1 parent d3d8680 commit b41cf5c

2 files changed

Lines changed: 99899 additions & 153 deletions

File tree

apps/015_SEN2_app/send2_app.py

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def enriched_persons(self):
10681068
enriched_df = enriched_df.merge(sen_types, on="child_id", how="left")
10691069

10701070
enriched_df["SENtype"] = enriched_df["SENtype"].apply(
1071-
lambda x: SENTypes[x].value if pd.notnull(x) else "Not yet determined"
1071+
lambda x: SENTypes[x.upper()].value if pd.notnull(x) else "Not yet determined"
10721072
)
10731073
enriched_df["SENSetting_mapped"] = enriched_df.apply(map_sen_settings, axis=1)
10741074

@@ -1348,8 +1348,11 @@ def enriched_active_plans(self):
13481348
enriched_df["WPB"].fillna("Not applicable", inplace=True)
13491349

13501350
enriched_df["ReviewMeeting"].fillna("Not applicable", inplace=True)
1351-
enriched_df["ReviewOutcome"].fillna("Not applicable", inplace=True)
1352-
enriched_df["LastReview"].fillna("Not applicable", inplace=True)
1351+
enriched_df["ReviewOutcome"] = enriched_df["ReviewOutcome"].map({
1352+
"M":"M - maintain the EHC plan",
1353+
"C":"C - cease the EHC plan",
1354+
"A":"A - Amend the EHC plan",})
1355+
enriched_df["LastReview"] = pd.to_datetime(enriched_df["LastReview"], format="%Y-%m-%d", errors="coerce")
13531356

13541357
enriched_df["TransferLA"] = enriched_df["TransferLA"].fillna("Not transferred")
13551358

@@ -1359,7 +1362,7 @@ def enriched_active_plans(self):
13591362
enriched_df["LA name"].fillna("Not transferred", inplace=True)
13601363

13611364
enriched_df["SENtype"] = enriched_df["SENtype"].apply(
1362-
lambda x: SENTypes[x].value if pd.notnull(x) else "Not yet determined"
1365+
lambda x: SENTypes[x.upper()].value if pd.notnull(x) else "Not yet determined"
13631366
)
13641367

13651368
enriched_df["SENunitIndicator"] = enriched_df["SENunitIndicator"].apply(
@@ -2162,18 +2165,31 @@ def get_datacontainer(_data_files):
21622165
col1, col2 = st.columns(2)
21632166

21642167
with col1:
2165-
total_requests = make_indicator(
2168+
total_reviews = make_indicator(
21662169
sliced_enriched_ap[
21672170
sliced_enriched_ap["LastReview"].notna()
21682171
& (sliced_enriched_ap["LastReview"] != "Not applicable")
21692172
],
2170-
"Total Reviews",
2173+
"Total reviews",
21712174
)
2172-
st.plotly_chart(total_requests, use_container_width=True, theme=None)
2175+
st.plotly_chart(total_reviews, use_container_width=True, theme=None)
2176+
2177+
total_reviews_year = make_indicator(
2178+
sliced_enriched_ap[
2179+
sliced_enriched_ap["LastReview"].notna()
2180+
& (sliced_enriched_ap["LastReview"] != "Not applicable")
2181+
& (sliced_enriched_ap["LastReview"] >= sen2.reference_period["start"])
2182+
],
2183+
"Total reviews in year",
2184+
)
2185+
st.plotly_chart(total_reviews_year, use_container_width=True, theme=None)
21732186

21742187
with col2:
21752188
review_outcomes = make_bar(
2176-
sliced_enriched_ap,
2189+
sliced_enriched_ap[
2190+
sliced_enriched_ap["LastReview"].notna()
2191+
& (sliced_enriched_ap["LastReview"] != "Not applicable")
2192+
],
21772193
"ReviewOutcome",
21782194
title="Outcome of most recent review",
21792195
x_label="Review Outcome",
@@ -2185,6 +2201,23 @@ def get_datacontainer(_data_files):
21852201
)
21862202
st.plotly_chart(review_outcomes, use_container_width=True, theme=None)
21872203

2204+
review_outcomes_year = make_bar(
2205+
sliced_enriched_ap[
2206+
sliced_enriched_ap["LastReview"].notna()
2207+
& (sliced_enriched_ap["LastReview"] != "Not applicable")
2208+
& (sliced_enriched_ap["LastReview"] >= sen2.reference_period["start"])
2209+
],
2210+
"ReviewOutcome",
2211+
title="Outcome of most recent review",
2212+
x_label="Review Outcome",
2213+
buckets=[
2214+
"M - maintain the EHC plan",
2215+
"C - cease the EHC plan",
2216+
"A - Amend the EHC plan",
2217+
],
2218+
)
2219+
st.plotly_chart(review_outcomes_year, use_container_width=True, theme=None)
2220+
21882221
with st.expander("CYP in selected drilldown:"):
21892222
st.table(sliced_enriched_ap.head())
21902223
st.table(sliced_enriched_persons)

0 commit comments

Comments
 (0)