People - Data Analysis | Trainee to Local Offices
TIS will need to now the previous and future Local Office that a trainee was/will be assigned to.
A query and table data structure are required to enable TIS to lookup this information.
select pm.PersonID, p.ManagingDeanery as lo, ProgrammeStartDate sd, pm.ProgrammeEndDateWithPOG ed, 'prg' as rec_type from [HEELIVE].[vwProgrammeMembership] as pm join [HEELIVE].[vwProgramme] as p on (p.ProgrammeID = pm.ProgrammeID) union all select pl.PersonID, ISNULL(p.ManagingDeaneryLETB, t.DeaneryLETB) as lo, pl.StartDate sd, pl.EndDate ed, 'plc' as rec_type from [HEELIVE].[vwPlacement] as pl join [HEELIVE].[vwPost] as p on (p.PostID = pl.PostID) left join [HEELIVE].[vwSite] as s on (s.SiteID = p.MainSiteID) left join [HEELIVE].[vwTrust] as t on (t.TrustID = s.TrustID) union all select ps.PersonID, t.DeaneryLETB as lo, cast(null as date) as sd, cast(null as date) as ed, 'asi' as rec_type FROM [HEELIVE].[vwPersonAssociatedSite] as ps JOIN [HEELIVE].[vwSite] as s on (s.SiteID = ps.SiteID) JOIN [HEELIVE].[vwTrust] as t on (t.TrustID = s.TrustID) GROUP BY ps.PersonID, t.DeaneryLETB union all select pt.PersonID, t.DeaneryLETB as lo, cast(null as date) as sd, cast(null as date) as ed, 'atr' as rec_type FROM [HEELIVE].[vwPersonAssociatedTrust] as pt JOIN [HEELIVE].[vwTrust] as t on (t.TrustID = pt.TrustID) GROUP BY pt.PersonID, t.DeaneryLETB union all select lo.UniqueID as PersonID, LocalOfficeName as lo, cast(null as date) as sd, cast(null as date) as ed, 'hlo' as rec_type from [HEELIVE].[vwLocalOffice] as lo where lo.ItemType = 'Person' and lo.LocalOfficeName is not null group by lo.UniqueID, LocalOfficeName
This current current generates the following volume of data
People Local Office History data volumes
rec_type | Row Count |
---|---|
prg | 246029 |
plc | 1402350 |
asi | 33292 |
atr | 35806 |
hlo | 261853 |
By Person Status
People Local Office History data volumes by Status
status | rec_type | Row Count |
---|---|---|
Current | hlo | 73337 |
Current | asi | 26839 |
Current | plc | 733600 |
Current | prg | 134198 |
Current | atr | 28996 |
Inactive | asi | 6453 |
Inactive | atr | 6810 |
Inactive | hlo | 177553 |
Inactive | plc | 668750 |
Inactive | prg | 111831 |
With the following rows returning a NULL LocalOffice value
People Local Office History with Null value
rec_type | Row Count |
---|---|
prg | 4478 |
plc | 57616 |
asi | 9475 |
atr | 9054 |
The following NULL values only have a NULL LocalOffice available, unless the source Intrepid data is cleansed to populate the ManagingDeanery field
People Local Office History with only Null values
rec_type | Row Count |
---|---|
asi | 3986 |
atr | 3909 |
plc | 216 |
Slack: https://hee-nhs-tis.slack.com/
Jira issues: https://hee-tis.atlassian.net/issues/?filter=14213