The process of service episode reconstruction is as follows:
1. Exclude any out of scope referrals, which are referrals where contact is not necessarily expected. These are any referrals that meet any of these criteria:
- ReferralEndCode is RI, RO or DZ – referral was declined or discharged with no direct contact required
- TeamType is 24 or 26 – Integrated Primary Access and Choice and Intellectual Disability teams
- ReferralEndCode is in (DM, DG, DD, ID) AND there does not exist an in-scope activity on the referral – referral ended in a way that indicates contact may not have been expected, and there was no activity
2. Within each unique combination of tangata whai ora and organisation, combine all overlapping in scope referrals into service episodes. This can be achieved in various ways, but the KPI programme uses a ‘gaps and islands’ approach:
- Sort referrals by Referral Start Date, Referral End Date, Referral ID
- Calculate the Ranked Order for each referral (sorting by Referral Start Date, Referral End Date, and then Referral ID to tiebreak)
- For each referral calculate the Previous End Date, which is the maximum Referral End Date of any referral with a lower Ranked Order (effectively the latest end date of any referral that started before this referral for this tangata whai ora at this organisation)
- For each referral compare Referral Start Date to Previous End Date to determine whether this is an index referral or overlap
- if referral Start Date <= Previous End Date this referral overlaps a previous referral and should roll into that service episode; set Index Referral?=0
- if referral Start Date> Previous End Date this referral starts a new service episode; set Index Referral? =1
- For each referral count the number of index referrals that have previously occurred for this tangata whai ora at this organisation, and append that value to the Organisation ID and HCU to form a globally unique service episode ID. For example the service episode for client ABC1234 at organisation G-0000 would be named G-0000_ABC1234_0; G-oo0o_ABC1234_1; etc.
- Service Episode Start Date = Referral Start Date of the index referral in each service episode.
3. Within each service episode identify the earliest in scope activity on any referral in the service episode
a. Exclude all activities where either of these criteria are met:
- ActivitySetting is one of these
- WR Written correspondence
- SM SMS text messaging
- PH Telephone
- OM Other social media, e-therapy
- ActivityType is one of these:
- T08 Care/liaison coordination contacts
- T24 Work opportunity/Employment/Vocational
- T33 Seclusion
- T35 Did not attend
- T37 On leave
- T43 Community support contacts
- T44 Advocacy
- T45 Peer support
- T52 Health coaching contact
- TCR MOH internal reference
b. Rank all remaining in scope activities by Activity Start Datetime, Referral ID, Activity ID
c. Calculate the Ranked Order for each in-scope activity (sorting by Activity Start Datetime, and then Referral ID and Activity ID to tiebreak)
d. Where Ranked Order = 1, this is the first in scope activity on the service episode
e. First In Scope Activity Start Datetime = Activity Start Datetime of this first in scope activity
f. Where Ranked Order = 3, this is the third in scope activity on the service episode
g. Third In Scope Activity Start Datetime = Activity Start Datetime of this first in scope activity
4. Calculate the wait time for each service episode:
a. Wait time to first in scope activity = difference in days between Service Episode Start Date and First In Scope Activity Start Datetime
b. Wait time to third in scope activity = difference in days between Service Episode Start Date and Third In Scope Activity Start Datetime
5. Calculate additional service episode metadata for use in analysis:
a. Service Episode End Date = maximum Referral End Date of all referrals within the service episode
b. Service Episode End Code = Referral End Code associated with the referral that has the maximum Referral End Date of all referrals within the service episode
i. Where multiple referrals share the maximum Referral End Date, if a DR exist then this is chosen. Otherwise the first alphabetical Referral End Code is chosen
c. Count Referrals = count referrals included in this service episode
d. Count Team Types = count of team types included in this service episode
e. Initial Team Type = Team Type of the index referral
f. Age at Service Episode Start = age in years on the Service Episode Start Date
g. In Scope Activity 365 Days Prior – Same Org? = if there exists an in-scope activity for this tangata whai ora at this organisation in the 365 days before Service Episode Start Date, them 1 else 0
h. In Scope Activity 365 Day Prior – Any Org? = if there exist an in-scope activity for this tangata wha ora at any organisation in the 365 days before Service Episode Start Date, then 1 else 0
i. Client Type =
i. If In Scope Activity 365 Days Prior – Same org? = then “Recurring – same organisation” else
ii. If In Scope Activity 365 Days Prior – Any org? = 1 then “Recurring – another organisation” else
6. Calculate additional activity flags for analysis:
a. Details of the first in scope activity based on its ActivityType
i. FirstInScopeAcitivityIsInpatient? = 1 if ActivityType in (T02, T03, T04)
ii. FirstInScopeActivityIsCommunityCrisis? = 1 if ActivityType in (T01, To5)
iii. FirstInScopeActivityIsCommunityNonCrisis? = 1 if ActivityType not in (T01, T02, T03, To4, T05)
iv. FirstInScopeActivityIsCommunityResidentail? = 1 if ActivityType in (T25, T26, T27, T28, T29, T30, T48)
v. FirstInScopeActivityIsCrisisorInpatient? = 1 if ActivityType in (T01, T02, T03, T04, T05)
b. Count out of scope activities before first in scope activity = count of all activities on a service episode where Activity Start Datetime < First In-Scope Activity Start Datetime and where the activity is not in scope (per the standard ActivityType definition)
An overlap is established by comparing referral start and end dates, not datetimes. For example, if Referral A ends at 09:30 on 01/01/2020 and Referral B begins at 23:30 on 01/01/2020, this is an overlap and these referrals will be combined. On the other hand, if Referral A ends at 23:30 on 01/01/2020 and Referral B begins at 00:30 on 02/01/2020, this is not an overlap and these referrals will be in separate service episodes (assuming there are no other referrals for this tangata whai ora).
When combining referrals, be careful not to simply sort referrals by start date and check for an overlap with the previous referral; tangata whai ora may have a single ongoing referral that overlaps multiple other brief referrals and forms a single service episode even though none of the brief referrals overlap one another.
Open referrals (Referral End Date = null) are included at step (1) regardless of whether an in-scope activity exists on that referral. This is to ensure that we reconstruct accurate service episodes, rather than discard pieces of a service journey.
The wait time is calculated using calendar days, not 24-hour periods. For example, a service episode starting at 09:00 on 01/01/2020 with the first in-scope activity at 23:30 on 01/01/2020 would have a wait-time of 0 days. A service episode starting at 23:30 on 01/01/2020 with first in-scope activity at 00:30 on 02/01/2020 would have a wait-time of 1 day.
There is no mechanism to categorise a service episode as urgent.
When identifying the Third in-scope activity, there is no correction for duplicate activities, and activities that occur on the same day are all considered individually. This is how a single service episode can have 0 days to both first and third in-scope activity, when three separate activities occur on the day of service episode start.
When allocating a service episode to a reporting period, we use the Service Episode Start Date.
Hide this info