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
1 change: 0 additions & 1 deletion nirc_ehr/resources/queries/dbo/q_clinremarks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ SELECT anmEvt.ANIMAL_EVENT_ID
WHEN (trim(anmEvt.STAFF_ID.STAFF_FIRST_NAME) IS NULL OR trim(anmEvt.STAFF_ID.STAFF_LAST_NAME) IS NULL) THEN 'unknown'
ELSE (trim(anmEvt.STAFF_ID.STAFF_FIRST_NAME)
|| '|' || trim(anmEvt.STAFF_ID.STAFF_LAST_NAME)) END) AS performedby,
anmEvt.EVENT_ID.EVENT_ID AS category,
anmEvt.DIAGNOSIS AS vetreview,
anmCmt.TEXT AS remark,
'Clinical' AS category,
Expand Down
2 changes: 2 additions & 0 deletions nirc_ehr/resources/queries/ehr/activeProtocols.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT protocol, title FROM ehr.protocol pr
WHERE pr.inactiveDate IS NULL OR pr.inactiveDate > now()
7 changes: 1 addition & 6 deletions nirc_ehr/resources/queries/ehr/project.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="project" tableDbType="TABLE">
<javaCustomizer class="org.labkey.nirc_ehr.table.NIRC_EHRCustomizer" />
<tableUrl>/EHR/projectDetails.view?project=${project}</tableUrl>
<insertUrl />
<importUrl />
Expand Down Expand Up @@ -67,12 +68,6 @@
<column columnName="contact_emails">
<isHidden>true</isHidden>
</column>
<column columnName="startdate">
<isHidden>true</isHidden>
</column>
<column columnName="enddate">
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
Expand Down
3 changes: 3 additions & 0 deletions nirc_ehr/resources/queries/ehr/project/.qview.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<columns>
<column name="name"/>
<column name="startdate"/>
<column name="enddate"/>
<column name="isActive"/>
</columns>
</customView>
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/ehr/protocol.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="protocol" tableDbType="TABLE">
<javaCustomizer class="org.labkey.nirc_ehr.table.NIRC_EHRCustomizer" />
<tableTitle>Protocol</tableTitle>
<columns>
<column columnName="InvestigatorId">
Expand Down
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/ehr/protocol/.qview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
<column name="isStock"/>
<column name="isHonorReset"/>
<column name="displayName"/>
<column name="isActive"/>
</columns>
</customView>
2 changes: 2 additions & 0 deletions nirc_ehr/resources/queries/study/BehaviorClinRemarks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT * FROM study.clinremarks
WHERE category = 'Behavior'
16 changes: 16 additions & 0 deletions nirc_ehr/resources/queries/study/BehaviorClinRemarks/.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" canOverride="true">
<sorts>
<sort column="date" descending="true"/>
</sorts>
<columns>
<column name="Id"/>
<column name="Id/Demographics/species"/>
<column name="Id/curLocation/cage/room/floor/building"/>
<column name="Id/curLocation/cage"/>
<column name="date"/>
<column name="performedby"/>
<column name="remark"/>
<column name="hx"/>
<column name="QCState"/>
</columns>
</customView>
2 changes: 2 additions & 0 deletions nirc_ehr/resources/queries/study/ClinicalClinRemarks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT * FROM study.clinremarks
WHERE category = 'Clinical'
20 changes: 20 additions & 0 deletions nirc_ehr/resources/queries/study/ClinicalClinRemarks/.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" canOverride="true">
<sorts>
<sort column="date" descending="true"/>
</sorts>
<columns>
<column name="Id"/>
<column name="Id/Demographics/species"/>
<column name="Id/curLocation/cage/room/floor/building"/>
<column name="Id/curLocation/cage"/>
<column name="date"/>
<column name="performedby"/>
<column name="remark"/>
<column name="s"/>
<column name="o"/>
<column name="a"/>
<column name="p"/>
<column name="hx"/>
<column name="QCState"/>
</columns>
</customView>
4 changes: 2 additions & 2 deletions nirc_ehr/resources/reports/additionalReports.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ surgicalCases
surgMedicationSchedule
surgMedicationScheduleDaily
pairings
behaviorRemarks Behavior query Behavior Remarks true study Clinical Remarks Behavior date false false qcstate/publicdata This report contains the behavior remarks entered about each animal
behaviorRemarks Behavior query Behavior Remarks true study BehaviorClinRemarks date false false qcstate/publicdata This report contains the behavior remarks entered about each animal
clinObsBehavior Behavior query Observations true study behaviorObservations date false false qcstate/publicdata This report contains one record for each encounter with each animal, including surergies, exams, procedures, etc.
clinremarks Clinical query Clinical Remarks true study Clinical Remarks Clinical date false false qcstate/publicdata This report contains the clinical remarks entered about each animal
clinremarks Clinical query Clinical Remarks true study ClinicalClinRemarks date false false qcstate/publicdata This report contains the clinical remarks entered about each animal
13 changes: 11 additions & 2 deletions nirc_ehr/resources/web/nirc_ehr/model/sources/Arrival.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,24 @@ EHR.model.DataModelManager.registerMetadata('Arrival', {
schemaName: 'ehr',
queryName: 'project',
keyColumn: 'project',
columns: 'project,name'
columns: 'project,name',
filterArray: [
LABKEY.Filter.create('isActive', true, LABKEY.Filter.Types.EQUAL),
]
},
allowBlank: false
},
arrivalProtocol: {
allowBlank: false,
columnConfig: {
width: 200
}
},
lookup: {
schemaName: 'ehr',
queryName: 'activeProtocols',
keyColumn: 'protocol',
columns: 'protocol,title'
},
},
performedby: {
hidden: true,
Expand Down
11 changes: 10 additions & 1 deletion nirc_ehr/resources/web/nirc_ehr/model/sources/Assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ EHR.model.DataModelManager.registerMetadata('Assignment', {
schemaName: 'ehr',
queryName: 'project',
keyColumn: 'project',
columns: 'project,name'
columns: 'project,name',
filterArray: [
LABKEY.Filter.create('isActive', true, LABKEY.Filter.Types.EQUAL),
]
}
}
},
Expand All @@ -29,6 +32,12 @@ EHR.model.DataModelManager.registerMetadata('Assignment', {
fixed: true,
width: 150
},
lookup: {
schemaName: 'ehr',
queryName: 'activeProtocols',
keyColumn: 'protocol',
columns: 'protocol,title'
},
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions nirc_ehr/resources/web/nirc_ehr/model/sources/Birth.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,23 @@ EHR.model.DataModelManager.registerMetadata('Birth', {
schemaName: 'ehr',
queryName: 'project',
keyColumn: 'project',
columns: 'project,name'
columns: 'project,name',
filterArray: [
LABKEY.Filter.create('isActive', true, LABKEY.Filter.Types.EQUAL),
]
}
},
birthProtocol: {
columnConfig: {
width: 200
},
allowBlank: false
allowBlank: false,
lookup: {
schemaName: 'ehr',
queryName: 'activeProtocols',
keyColumn: 'protocol',
columns: 'protocol,title'
},
},
'Id/demographics/birth': {
allowBlank: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected List<String> getButtonConfigs()
if (isVet)
{
defaultButtons.add("SUBMIT"); //submit final
defaultButtons.add("DEATH_NECROPSY_VET_REVIEW"); //submit for review
}
else if (isVetTech)
{
Expand Down
27 changes: 27 additions & 0 deletions nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ public void doTableSpecificCustomizations(AbstractTableInfo ti)
{
customizeProtocolTable(ti);
}
if (matches(ti, "ehr", "project"))
{
addIsActiveForProject(ti, EHRService.EndingOption.activeAfterMidnightTonight);
}
if (matches(ti, "study", "protocolAssignment"))
{
EHRService.get().addIsActiveCol(ti, false, EHRService.EndingOption.activeAfterMidnightTonight, EHRService.EndingOption.activeAfterMidnightTonight);
Expand All @@ -701,6 +705,29 @@ public void doTableSpecificCustomizations(AbstractTableInfo ti)
}
}

private void addIsActiveForProject(AbstractTableInfo ti, EHRService.EndingOption... endOptions)
{
String name = "isActive";
if (ti.getColumn(name) == null)
{
SQLFragment sql = new SQLFragment("(CASE " +
// when enddate is null, it is active
" WHEN (" + ExprColumn.STR_TABLE_ALIAS + ".enddate IS NULL) THEN " + ti.getSqlDialect().getBooleanTRUE());
for (EHRService.EndingOption endOption : endOptions)
{
sql.append(endOption.getSql());
}
sql.append(
" WHEN (CAST(" + ExprColumn.STR_TABLE_ALIAS + ".enddate AS DATE) > {fn curdate()}) THEN " + ti.getSqlDialect().getBooleanTRUE() +
" ELSE " + ti.getSqlDialect().getBooleanFALSE() +
" END)");

ExprColumn col = new ExprColumn(ti, name, sql, JdbcType.BOOLEAN, ti.getColumn("enddate"));
col.setLabel("Is Active?");
ti.addColumn(col);
}
}

public void doSharedCustomization(AbstractTableInfo ti)
{
for (var col : ti.getMutableColumns())
Expand Down