Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE ehr_compliancedb.requirementsperemployee ADD COLUMN LSID LSIDtype;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE ehr_compliancedb.requirementsperemployee ADD Lsid LsidType null;
11 changes: 11 additions & 0 deletions EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,17 @@
<isKeyField>true</isKeyField>
<columnTitle>Key</columnTitle>
</column>
<column columnName="lsid">
<datatype>lsidtype</datatype>
<isReadOnly>true</isReadOnly>
<isHidden>true</isHidden>
<isUserEditable>false</isUserEditable>
<fk>
<fkColumnName>ObjectUri</fkColumnName>
<fkTable>Object</fkTable>
<fkDbSchema>exp</fkDbSchema>
</fk>
</column>
<column columnName="employeeid">
<columnTitle>Employee Id</columnTitle>
<fk>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbSchemaType;
import org.labkey.api.exp.property.PropertyService;
import org.labkey.api.ldk.ExtendedSimpleModule;
import org.labkey.api.ldk.LDKService;
import org.labkey.api.ldk.notification.NotificationService;
import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind;
import org.labkey.ehr_compliancedb.notification.EmployeeComplianceNotification;
import org.labkey.api.module.ModuleContext;
import org.labkey.ehr_compliancedb.api.EHR_ComplianceService;
Expand Down Expand Up @@ -49,7 +51,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
return 12.44;
return 25.001;
}

@Override
Expand All @@ -64,6 +66,7 @@ protected void init()
addController(CONTROLLER_NAME, EHR_ComplianceDBController.class);

EHR_ComplianceService.setInstance(new EHR_ComplianceServiceImpl());
PropertyService.get().registerDomainKind(new EHRComplianceDBDomainKind());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import org.labkey.api.module.Module;
import org.labkey.api.query.DefaultSchema;
import org.labkey.api.query.QuerySchema;
import org.labkey.api.query.SimpleTableDomainKind;
import org.labkey.api.query.SimpleUserSchema;
import org.labkey.api.security.User;
import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind;

/**
* User: bimber
Expand All @@ -36,6 +38,7 @@
public class EHR_ComplianceDBUserSchema extends SimpleUserSchema
{
public static final String TABLE_REQUIREMENTS = "requirements";
private static final String TABLE_REQUIREMENTSPEREMPLOYEE = "requirementsperemployee";

public EHR_ComplianceDBUserSchema(User user, Container container, DbSchema dbschema)
{
Expand All @@ -50,6 +53,23 @@ public TableInfo createTable(String name, ContainerFilter cf)
SchemaTableInfo table = _dbSchema.getTable(name);
return new ContainerScopedTable<>(this, table, cf, "requirementname").init();
}
else if (TABLE_REQUIREMENTSPEREMPLOYEE.equalsIgnoreCase(name))
{
SchemaTableInfo table = _dbSchema.getTable(name);
return new SimpleTable<>(this, table, cf)
{
// There are issues with the '_' in the name of this module and creating template domains. This addresses
// the domain URI by normalizing with the domain kind.
@Override
public String getDomainURI()
{
if (_objectUriCol == null)
return null;

return SimpleTableDomainKind.getDomainURI(EHRComplianceDBDomainKind.KIND_NAME, getName(), getDomainContainer(), _userSchema.getUser());
}
}.init();
}

return super.createTable(name, cf);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.labkey.ehr_compliancedb.model;

import org.labkey.api.data.Container;
import org.labkey.api.exp.property.Domain;
import org.labkey.api.gwt.client.model.GWTPropertyDescriptor;
import org.labkey.api.query.ExtendedTableDomainKind;
import org.labkey.api.security.User;
import org.labkey.api.security.permissions.AdminPermission;
import org.labkey.data.xml.domainTemplate.DomainTemplateType;
import org.labkey.data.xml.domainTemplate.EHRComplianceDBTemplateType;


import java.util.List;
import java.util.Set;

public class EHRComplianceDBDomainKind extends ExtendedTableDomainKind
{
public static final String KIND_NAME = "EHRComplianceDB";

@Override
public boolean canCreateDefinition(User user, Container container)
{
return container.hasPermission("EHRComplianceDBDomainKind.canCreateDefinition", user, AdminPermission.class);
}

@Override
protected String getSchemaName()
{
return KIND_NAME.toLowerCase();
}

@Override
protected String getNamespacePrefix()
{
return KIND_NAME.toLowerCase();
}

@Override
public String getKindName()
{
return KIND_NAME;
}

@Override
public Set<String> getReservedPropertyNames(Domain domain, User user)
{
return super.getReservedPropertyNames(domain, user);
}

@Override
public boolean matchesTemplateXML(String templateName, DomainTemplateType template, List<GWTPropertyDescriptor> properties)
{
return template instanceof EHRComplianceDBTemplateType;
}
}


45 changes: 13 additions & 32 deletions ehr/resources/queries/study/HousingOverlaps.sql
Original file line number Diff line number Diff line change
@@ -1,40 +1,21 @@
/*
* Copyright (c) 2011-2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/

/**
* This query is designed to find housing records that overlap. In this query, the overlap to calculated based on both date and time
* A record that ends at the same time that a second record begins is not considered an overlap.
*/
PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL)

Modified by Kollil on 7/23/25 - Added Area field to the query and the rooms are filtered by area(s) selected, refer to tkt # 12894
*/
SELECT
h.lsid,
h.id,
h.room,
h.cage,
h.date,
h.enddate,
h.reason,
h.remark,
h.qcstate

h.lsid,
h.id,
h.room.area as area, -- Added by Kollil
h.room,
h.cage,
h.date,
h.enddate,
h.reason,
h.remark,
h.qcstate
FROM study.housing h

WHERE
h.qcstate = 18

(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND
(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND

/* entered startdate must be <= entered enddate */
coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now())
and

/* entered startdate must be less than record's enddate */
coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now())
and

/* entered enddate must be greater than record's startdate */
coalesce(ENDDATE, now()) >= coalesce(h.date, now())
31 changes: 0 additions & 31 deletions ehr/resources/queries/study/HousingOverlapsById.sql

This file was deleted.

64 changes: 0 additions & 64 deletions ehr/resources/queries/study/HousingOverlapsById/.qview.xml

This file was deleted.

31 changes: 0 additions & 31 deletions ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql

This file was deleted.

Loading