Skip to content

Commit cf4696e

Browse files
committed
updated drr indicators, program code file download
1 parent 0452746 commit cf4696e

File tree

4 files changed

+71
-17
lines changed

4 files changed

+71
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The [Policy on Service and Digital](https://www.tbs-sct.canada.ca/pol/doc-eng.as
9393

9494
### Summary Files for Visualization and Review (outputs/indicators/)
9595
*All tables were built with `service_scope` containing `EXTERN` or `ENTERPRISE`*
96-
- `drr_all.csv`: a concatenated table with all the drr indicator columns and scores (dr_2467: percentage of high-volume external services (>=45k applications) that are delivered online end-to-end, dr_2468: percentage of high-volume external services (>=45k applications and telephone enquiries) that met at least one service standard, dr_2469: percentage of applications for high-volume external services (>45k applications) that used the online channel)
96+
- `drr_all.csv`: a concatenated table with all the drr indicator columns and scores (dr_2467: percentage of high-volume external services (>=45k applications) that are delivered online end-to-end, dr_2468: percentage of high-volume external services (>=45k applications and telephone enquiries) that met at least one service standard, dr_2469: percentage of applications for high-volume external services (>45k applications) that used the online channel), service_with_feedback_percentage: percentage of all services that have indicated something other than 'NON' in the client feedback channel field.
9797
- `maf_all.csv`: a concatenated table with all the maf columns and scores (maf1: percentage of services that have service standards, maf2: percentage of service standards met, maf5: percentage of applicable services that can be completed online end-to-end, maf6: percentage of client interaction points that are available online, maf8: percentage of services which have used client feedback to improve services in the year prior to reporting)
9898
- `service_fte_spending.csv`: FTEs and spending for programs delivering services.
9999
- `si_oip.csv`: Online interaction points activation status by service for the latest available fiscal year.

notebooks/experiment-template.ipynb

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"id": "fd2d413a-666f-49d4-b86c-7d6898a496a5",
77
"metadata": {},
88
"outputs": [],
@@ -42,28 +42,50 @@
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
45-
"config['input_dir']"
45+
"# si = pd.read_csv(\"https://github.com/gcperformance/service-data/releases/latest/download/si.csv\", \n",
46+
"# keep_default_na=False, \n",
47+
"# na_values='', \n",
48+
"# delimiter=';'\n",
49+
"# )\n",
50+
"\n",
51+
"# ss = pd.read_csv(\"https://github.com/gcperformance/service-data/releases/latest/download/ss.csv\", \n",
52+
"# keep_default_na=False, \n",
53+
"# na_values='', \n",
54+
"# delimiter=';'\n",
55+
"# )\n",
56+
"\n",
57+
"\n",
58+
"config=get_config()\n",
59+
"si_path = parent_dir / 'outputs' / 'si.csv'\n",
60+
"si = pd.read_csv(si_path, keep_default_na=False, na_values='', delimiter=';', engine='python', skipfooter=2)"
4661
]
4762
},
4863
{
4964
"cell_type": "code",
50-
"execution_count": null,
65+
"execution_count": 10,
5166
"id": "be959c79",
5267
"metadata": {},
5368
"outputs": [],
5469
"source": [
55-
"si = pd.read_csv(\"https://github.com/gcperformance/service-data/releases/latest/download/si.csv\", \n",
56-
" keep_default_na=False, \n",
57-
" na_values='', \n",
58-
" delimiter=';'\n",
59-
" )\n",
70+
"dr_client_feedback_pc = si[['service_id', 'fiscal_yr', 'fy_org_id_service_id', 'client_feedback_channel']].copy()\n",
71+
"dr_client_feedback_pc['client_feedback_collected'] = (dr_client_feedback_pc['client_feedback_channel']=='NON')\n",
72+
"\n",
73+
"# Determine fy-level counts for services that accept client feedback\n",
74+
"dr_client_feedback_pc = dr_client_feedback_pc.groupby(['fiscal_yr'], as_index=False).agg(\n",
75+
" service_count=('fy_org_id_service_id', 'nunique'),\n",
76+
" service_with_feedback_count=('client_feedback_collected', 'sum')\n",
77+
")\n",
6078
"\n",
61-
"ss = pd.read_csv(\"https://github.com/gcperformance/service-data/releases/latest/download/ss.csv\", \n",
62-
" keep_default_na=False, \n",
63-
" na_values='', \n",
64-
" delimiter=';'\n",
65-
" )"
79+
"dr_client_feedback_pc['service_with_feedback_percentage'] = dr_client_feedback_pc['service_with_feedback_count']/dr_client_feedback_pc['service_count']\n"
6680
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": null,
85+
"id": "75409d49",
86+
"metadata": {},
87+
"outputs": [],
88+
"source": []
6789
}
6890
],
6991
"metadata": {

src/load.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ def download_program_csv_files(config):
4343
file_path = INPUT_DIR / f"{filename}.csv"
4444

4545
try:
46+
# Set up a session
47+
s = requests.Session()
48+
4649
# Fetch the file from the URL
47-
response = requests.get(url)
50+
# verify is set to false on advice from PSPC, who acknowledged they will not be fixing the SSL certificate issue
51+
response = s.get(url, verify=False)
4852
response.raise_for_status() # Raise an error for bad responses (4xx, 5xx)
4953

5054
# Save the content to a file
@@ -67,8 +71,12 @@ def download_program_csv_files(config):
6771
file_path = INPUT_DIR / f"{filename}.csv"
6872

6973
try:
74+
# Set up a session
75+
s = requests.Session()
76+
7077
# Fetch the file from the URL
71-
response = requests.get(url)
78+
# verify is set to false on advice from PSPC, who acknowledged they will not be fixing the SSL certificate issue
79+
response = s.get(url, verify=False)
7280
response.raise_for_status() # Raise an error for bad responses (4xx, 5xx)
7381

7482
# Save the content to a file

src/process.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,31 @@ def drr(si, ss, config, snapshot=False):
566566
# Determine score
567567
dr2469['dr2469_score'] = (dr2469['hv_online_applications']/dr2469['hv_total_applications'])*100
568568

569+
# =================================
570+
# DRR Indicator: Fraction of services that accept client feedback:
571+
# Number of entries in the service inventory that are identified as having client
572+
# feedback (client_feedback_channel not equal to 'NON') divided by the total number of service inventory entries times 100
573+
574+
# (# of entries with client feedback / total number of entries) * 100
575+
576+
# Select relevant columns from service inventory
577+
dr_client_feedback_pc = si[['service_id', 'fiscal_yr', 'fy_org_id_service_id', 'client_feedback_channel']].copy()
578+
579+
# Identify which services indicated something other than 'NON' in the client feedback channel
580+
dr_client_feedback_pc['client_feedback_collected'] = (dr_client_feedback_pc['client_feedback_channel'] != 'NON')
581+
582+
# Determine fy-level counts for services that accept client feedback
583+
dr_client_feedback_pc = dr_client_feedback_pc.groupby(['fiscal_yr'], as_index=False).agg(
584+
service_with_feedback_count=('client_feedback_collected', 'sum'),
585+
service_count=('fy_org_id_service_id', 'nunique')
586+
)
587+
588+
# Determine score
589+
dr_client_feedback_pc['service_with_feedback_percentage'] = (dr_client_feedback_pc['service_with_feedback_count']/dr_client_feedback_pc['service_count'])*100
590+
591+
569592
# === SUMMARY DRR TABLE ===
570-
drr_dfs = [dr2467, dr2468, dr2469]
593+
drr_dfs = [dr2467, dr2468, dr2469, dr_client_feedback_pc]
571594
index_cols = ['fiscal_yr']
572595

573596
# Set index for each DataFrame in the list
@@ -581,6 +604,7 @@ def drr(si, ss, config, snapshot=False):
581604
# "dr2467": dr2467,
582605
# "dr2468": dr2468,
583606
# "dr2469": dr2469,
607+
# "dr_client_feedback_pc": dr_client_feedback_pc,
584608
"drr_all": drr_all
585609
}
586610

0 commit comments

Comments
 (0)