Skip to content

Commit

Permalink
Merge 23.11 to 24.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	ONPRC_EHR_ComplianceDB/resources/views/begin.html
  • Loading branch information
cnathe committed Jan 9, 2025
2 parents 5d3e35e + c818022 commit 4b74509
Show file tree
Hide file tree
Showing 27 changed files with 1,562 additions and 395 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<table tableName="complianceProcedureRecentTests" tableDbType="NOT_IN_DB">
<tableTitle>Employee Requirement Summary</tableTitle>
<columns>
<column columnName="employeeId">
<column columnName="employeeid">
<columnTitle>Employee ID</columnTitle>
<isKeyField>true</isKeyField>
<fk>
Expand All @@ -14,17 +14,20 @@

</fk>
</column>
<column columnName="requirementName">
<column columnName="rowid">
<columnTitle>Row ID</columnTitle>
</column>
<column columnName="requirementname">
<columnTitle>Requirement Name</columnTitle>
<displayWidth>90</displayWidth>
<displayWidth>250</displayWidth>
<fk>
<fkDbSchema>ehr_compliancedb</fkDbSchema>
<fkTable>requirements</fkTable>
<fkColumnName>requirementName</fkColumnName>
</fk>
<facetingBehavior>ALWAYS_OFF</facetingBehavior>
</column>
<column columnName="timesCompleted">
<column columnName="times_completed">
<columnTitle>Times Completed</columnTitle>
<displayWidth>50</displayWidth>
<url>/query/executeQuery.view?schemaName=ehr_compliancedb&amp;
Expand All @@ -33,21 +36,46 @@
query.requirementName~eq=${requirementName}&amp;
</url>
</column>
<column columnName="ExpiredPeriod">
<column columnName="expired_period">
<columnTitle>Expire Period (Months)</columnTitle>
<displayWidth>70</displayWidth>
</column>

<column columnName="NewExpirePeriod">
<column columnName="new_expired_period">
<columnTitle>New Expire Period (Months)</columnTitle>
<displayWidth>70</displayWidth>
</column>

<column columnName="email">
<columnTitle>Email</columnTitle>
<displayWidth>70</displayWidth>
</column>

<column columnName="lastname">
<columnTitle>Last Name</columnTitle>
<displayWidth>110</displayWidth>
</column>

<column columnName="firstname">
<columnTitle>First Name</columnTitle>
<displayWidth>110</displayWidth>
</column>

<column columnName="host">
<columnTitle>Host</columnTitle>
<displayWidth>110</displayWidth>
</column>
<column columnName="supervisor">
<columnTitle>Supervisor</columnTitle>
<displayWidth>150</displayWidth>
</column>

<column columnName="unit">
<columnTitle>Unit</columnTitle>
<displayWidth>70</displayWidth>
<displayWidth>210</displayWidth>
</column>
<column columnName="mostrecentdate">
<column columnName="mostrecentcompleted_date">
<columnTitle>Most Recent Date</columnTitle>
<formatString>yyyy-MM-dd</formatString>
<displayWidth>70</displayWidth>
</column>
<column columnName="comment">
Expand All @@ -58,7 +86,16 @@
<columnTitle>Category</columnTitle>
<displayWidth>70</displayWidth>
</column>
<column columnName="MonthsUntilRenewal">

<column columnName="trainee_type">
<columnTitle>Trainee Type</columnTitle>
<displayWidth>70</displayWidth>
</column>
<column columnName="requirement_name_type">
<columnTitle>Requirement Name Type</columnTitle>
<displayWidth>180</displayWidth>
</column>
<column columnName="months_until_renewal">
<columnTitle>Months Until Renewal</columnTitle>
<displayWidth>60</displayWidth>
<conditionalFormats>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,149 +1,2 @@
/*
* Copyright (c) 2010-2014 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/

-- Modified: 6-14-2022 R.Blasa ComplianceRecentTests.sql
-- Training that was completed by an employee and being recorded as completed as a Unit or Category
select b.requirementname,
a.employeeid,
group_concat(distinct a.unit,chr(10)) as unit,
group_concat(distinct a.category,chr(10)) as category,
group_concat(distinct b.trackingflag) as trackingflag,


(select count(zz.date) from completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as timesCompleted,

(select k.expireperiod from Requirements k where k.requirementname = b.requirementname) as ExpiredPeriod,

( select (age_in_months(max(pq.date), tt.reviewdate) ) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,

(select max(zz.date) from completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid ) as MostRecentDate,

(Select group_concat(distinct yy.comment, chr(10)) from completiondates yy where yy.date in (select max(zz.date) from completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as comment,
(Select group_concat(distinct yy.snooze_date , chr(10)) from completiondates yy where yy.date in (select max(zz.date) from completiondates zz where zz.requirementname= b.requirementname and zz.employeeid= a.employeeid )
And yy.requirementname= b.requirementname and yy.employeeid= a.employeeid ) as snooze_date,

CAST(
CASE

WHEN (select max(st.date) from completiondates st where st.requirementname = b.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
WHEN ( select (tt.expireperiod) from ehr_compliancedb.requirements tt where tt.requirementname = b.requirementname group by tt.expireperiod ) = 0 then Null


WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate) )) > 0 THEN

( select ( age_in_months(max(pq.date), tt.reviewdate) - ( age_in_months(max(pq.date), curdate())) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) )




ELSE ( select (tt.expireperiod) - ( age_in_months(max(pq.date), curdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = b.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )

END AS double) AS MonthsUntilRenewal



from employeeperunit a ,requirementspercategory b
where ( a.unit = b.unit or a.category = b.category )
And b.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
And b.requirementname = t.requirementname)
And b.requirementname in ( select k.requirementname from ehr_compliancedb.requirements k where k.datedisabled is null)

And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where p.enddate is null)



group by b.requirementname,a.employeeid


union

-- Training that was completed by an employee but not recorded as being completed as a Unit or Category
select a.requirementname,
a.employeeid,
null as unit,
null as category,
'No' as trackingflag,


(select count(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as timesCompleted,

(select k.expireperiod from ehr_compliancedb.Requirements k where k.requirementname = a.requirementname) as ExpiredPeriod,

( select (age_in_months(max(pq.date), tt.reviewdate) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) ) as NewExpirePeriod,

(select max(zz.date) from ehr_compliancedb.completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid ) as MostRecentDate,

(Select group_concat(distinct yy.comment, chr(10)) from completiondates yy where yy.date in (select max(zz.date) from completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as comment,

(Select group_concat(distinct yy.snooze_date , chr(10)) from completiondates yy where yy.date in (select max(zz.date) from completiondates zz where zz.requirementname= a.requirementname and zz.employeeid= a.employeeid )
And yy.requirementname= a.requirementname and yy.employeeid= a.employeeid ) as snooze_date,

CAST(
CASE
WHEN (select max(st.date) from completiondates st where st.requirementname = a.requirementname and st.employeeid = a.employeeid ) IS NULL then 0
WHEN ( select (tt.expireperiod) from ehr_compliancedb.requirements tt where tt.requirementname = a.requirementname group by tt.expireperiod ) = 0 then Null


WHEN ( select count(*) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate) )) > 0 THEN

( select ( age_in_months(max(pq.date), tt.reviewdate) - ( age_in_months(max(pq.date), curdate())) )from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod, tt.reviewdate
having (tt.expireperiod) > (age_in_months(max(pq.date), tt.reviewdate)) and (tt.reviewdate is not null) )




ELSE ( select (tt.expireperiod) - ( age_in_months(max(pq.date), curdate())) from ehr_compliancedb.requirements tt, ehr_compliancedb.completiondates pq where tt.requirementname = a.requirementname and pq.requirementname = tt.requirementname and pq.employeeid = a.employeeid group by tt.expireperiod )

END AS double) AS MonthsUntilRenewal


from ehr_compliancedb.completiondates a
where a.requirementname not in (select distinct h.requirementname from ehr_compliancedb.employeeperunit k, ehr_compliancedb.requirementspercategory h Where (k.unit = h.unit
or k.category = h.category) And a.employeeid = k.employeeid )
And a.requirementname not in (select distinct t.requirementname from ehr_compliancedb.employeerequirementexemptions t Where a.employeeid = t.employeeid
And a.requirementname = t.requirementname)
And a.employeeid in (select p.employeeid from ehr_compliancedb.employees p where p.enddate is null)
And a.requirementname in ( select k.requirementname from ehr_compliancedb.requirements k where k.requirementname = a.requirementname And k.datedisabled is null)

group by a.requirementname,a.employeeid

UNION

-- Additional requirements for employees that have not completed training, but is required
select j.requirementname,
j.employeeid,
null as unit,
null as category,
'Yes' as trackingflag,
null as timesCompleted,
null as ExpiredPeriod,
null as NewExpirePeriod,
null as MostRecentDate,
'' as comment,
null as snooze_date,
null AS MonthsUntilRenewal


from ehr_compliancedb.RequirementsPerEmployee j
Where j.requirementname not in (select z.requirementname from ehr_compliancedb.completiondates z where z.requirementname = j.requirementname
and z.employeeid = j.employeeid and z.date is not null)
And j.employeeid in (select p.employeeid from ehr_compliancedb.employees p where p.enddate is null)
And j.requirementname in ( select k.requirementname from ehr_compliancedb.requirements k where k.requirementname = j.requirementname And k.datedisabled is null)


group by j.requirementname,j.employeeid





Select *
from onprc_ehr_compliancedb.ComplianceProcedureReport
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" label="All">
<columns>
<column name="employeeId/email"/>
<column name="employeeId"/>
<column name="employeeId/lastName"/>
<column name="employeeId/firstName"/>
<column name="employeeId/majorudds"/>
<column name="email"/>
<column name="employeeid"/>
<column name="lastname"/>
<column name="firstname"/>
<column name="host"/>
<column name="unit"/>
<column name="category"/>
<column name="requirementName"/>
<column name="requirementname"/>
<column name="trackingflag"/>
<column name="timesCompleted"/>
<column name="ExpiredPeriod"/>
<column name="NewExpirePeriod"/>
<column name="MostRecentDate"/>
<column name="times_completed"/>
<column name="expired_period"/>
<column name="new_expired_period"/>
<column name="mostrecentcompleted_date"/>
<column name="comment"/>
<column name="MonthsUntilRenewal"/>
<column name="months_until_renewal"/>
<column name="snooze_date"/>
</columns>
<sorts>
<sort column="employeeId/lastName" descending="false"/>
<sort column="employeeId/firstName" descending="false"/>
<sort column="requirementName" descending="false"/>
<sort column="lastname" descending="false"/>
<sort column="firstName" descending="false"/>
<sort column="requirementname" descending="false"/>
</sorts>
</customView>
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<columns>
<column name="employeeId"/>
<column name="employeeId/email"/>
<column name="employeeId/lastName"/>
<column name="employeeId/firstName"/>
<column name="employeeId/supervisor"/>
<column name="employeeid"/>
<column name="email"/>
<column name="lastname"/>
<column name="firstname"/>
<column name="supervisor"/>
<column name="employeeId/location"/>
<column name="employeeId/category"/>
<column name="category"/>
<column name="employeeId/notes"/>
<column name="employeeId/isActive"/>
<column name="requirementName"/>
<column name="requirementName/type"/>
<column name="MostRecentDate"/>
<column name="MonthsUntilRenewal"/>
<column name="requirementname"/>
<column name="requirement_name_type"/>
<column name="mostrecentcompleted_date"/>
<column name="months_until_renewal"/>
</columns>
<sorts>
<sort column="employeeId/lastName" descending="false"/>
<sort column="employeeId/firstName" descending="false"/>
<sort column="requirementName" descending="false"/>
<sort column="lastname" descending="false"/>
<sort column="firstname" descending="false"/>
<sort column="requirementname" descending="false"/>
</sorts>
<filters>
<filter column="MonthsUntilRenewal" operator="lte" value="2"/>
<filter column="months_until_renewal" operator="lte" value="2"/>
<filter column="employeeid/isActive" operator="eq" value="true"/>
<filter column="requirementName/datedisabled" operator="isblank"/>
<filter column="requirementName/type" operator="eq" value="Occupational Health"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">

<sorts>
<sort column="employeeId/lastName" descending="false"/>
<sort column="employeeId/firstName" descending="false"/>
<sort column="requirementName" descending="false"/>
<sort column="lastname" descending="false"/>
<sort column="firstName" descending="false"/>
<sort column="requirementname" descending="false"/>
</sorts>
<filters>
<filter column="MonthsUntilRenewal" operator="lte" value="2"/>
<filter column="employeeid/isActive" operator="eq" value="true"/>
<filter column="requirementName/datedisabled" operator="isblank"/>
<filter column="requirementName/type" operator="containsnoneof" value="EHRS;Occupational Health"/>
<filter column="months_until_renewal" operator="lte" value="2"/>
<filter column="requirement_name_type" operator="containsnoneof" value="EHRS;Occupational Health"/>
<filter column="category" operator="doesnotcontain" value="Vendor / Contractor"/>
</filters>

Expand Down
Loading

0 comments on commit 4b74509

Please sign in to comment.