Skip to content
Open
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
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7BiochemistryPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Biochemistry Results Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT
obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) || '-' ||
COALESCE(CAST(obr.MESSAGE_ID AS VARCHAR), '') || '-' ||
COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '') || '-' ||
COALESCE(CAST(obr.SET_ID AS VARCHAR), '') || '-' ||
COALESCE(CAST(COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) AS VARCHAR), '') || '-' ||
COALESCE(CAST(nte.COMMENT AS VARCHAR), '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand All @@ -20,6 +21,6 @@ GROUP BY obr.ANIMAL_ID, obr.OBSERVATION_DATE_TM, obr.MESSAGE_ID, COALESCE (lp.Se

IN
(
select DISTINCT TestName as TEST_NAME from snprc_ehr.labwork_panels t
select DISTINCT ltrim(Rtrim(TestName)) as TEST_NAME from snprc_ehr.labwork_panels t
where t.includeInPanel = true AND t.ServiceId.Dataset='Biochemistry'
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!-- $S is the escape code for / -->
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<columns>
<column name="Id"/>
<column name="Date"/>
<column name="CREATININE::RESULT"/>
<column name="CREATININE::ABNORMAL_FLAGS"/>
<column name="GLUCOSE::RESULT"/>
<column name="GLUCOSE::ABNORMAL_FLAGS"/>
<column name="BUN$SCREAT RATIO::RESULT"/>
<column name="BUN$SCREAT RATIO::ABNORMAL_FLAGS"/>
<column name="TOTAL PROTEIN::RESULT"/>
<column name="TOTAL PROTEIN::ABNORMAL_FLAGS"/>
<column name="ALBUMIN::RESULT"/>
<column name="ALBUMIN::ABNORMAL_FLAGS"/>
<column name="GLOBULIN (CALC)::RESULT"/>
<column name="GLOBULIN (CALC)::ABNORMAL_FLAGS"/>
<column name="A$SG RATIO (CALC)::RESULT"/>
<column name="A$SG RATIO (CALC)::ABNORMAL_FLAGS"/>
<column name="ALT $S SGPT::RESULT"/>
<column name="ALT $S SGPT::ABNORMAL_FLAGS"/>
<column name="AST $S SGOT::RESULT"/>
<column name="AST $S SGOT::ABNORMAL_FLAGS"/>
<column name="ALK PHOSPHATASE::RESULT"/>
<column name="ALK PHOSPHATASE::ABNORMAL_FLAGS"/>
<column name="SODIUM::RESULT"/>
<column name="SODIUM::ABNORMAL_FLAGS"/>
<column name="POTASSIUM::RESULT"/>
<column name="POTASSIUM::ABNORMAL_FLAGS"/>
<column name="CHLORIDE::RESULT"/>
<column name="CHLORIDE::ABNORMAL_FLAGS"/>
<column name="CARBON DIOXIDE::RESULT"/>
<column name="CARBON DIOXIDE::ABNORMAL_FLAGS"/>
<column name="ANION GAP (CALC)::RESULT"/>
<column name="ANION GAP (CALC)::ABNORMAL_FLAGS"/>
<column name="COMMENT"/>
</columns>
<sorts>
<sort column="Id"/>
<sort column="Date" descending="true"/>
</sorts>
</customView>

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7CulturePivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Culture and Sensitivity Results Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/snprc_ehr/HL7CulturePivot.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT
obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || COALESCE(CAST(obr.MESSAGE_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(obr.SET_ID AS VARCHAR), '')
|| '-' || COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7HematologyPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Hematology Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT
obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || COALESCE(obr.MESSAGE_ID, '')
|| '-' || COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(obr.SET_ID AS VARCHAR), '')
|| '-' || COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7HistologyPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Histology Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SELECT obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID
|| '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || COALESCE(obr.MESSAGE_ID, '')
|| '-' || COALESCE(CAST(obr.SET_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(nte.COMMENT AS VARCHAR), '')
as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
7 changes: 7 additions & 0 deletions snprc_ehr/resources/queries/snprc_ehr/HL7MiscPivot.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7MiscPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Misc Tests Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/snprc_ehr/HL7MiscPivot.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SELECT obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) || '-' ||
CAST(obr.MESSAGE_ID AS VARCHAR) || '-' || CAST(obr.PROCEDURE_ID AS VARCHAR) || '-' ||
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) || '-' || COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7ParasitologyPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Parasitology Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SELECT obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) || '-' ||
COALESCE(CAST(obr.MESSAGE_ID AS VARCHAR), '') || '-' ||
COALESCE(obr.PROCEDURE_NAME, '') || '-' ||
COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '') || '-' ||
COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7SurveillancePivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Surveillance Pivot</tableTitle>
<columns>
<column columnName="PROCEDURE_NAME">
<isHidden>true</isHidden>
</column>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
select Id,
date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field references undefined columns. The query selects from snprc_ehr.HL7SurveillancePivotInner which doesn't have an alias obr, and the columns are already aliased as Id and date in that inner query. Change obr.ANIMAL_ID to Id and obr.OBSERVATION_DATE_TM to date to match the existing column names in the SELECT list.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Id || '-' || CAST(date AS VARCHAR) as key,

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || COALESCE(CAST(PROCEDURE_ID AS VARCHAR), '')
|| '-' || COALESCE(PROCEDURE_NAME, '')
|| '-' || COALESCE(COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
PROCEDURE_NAME,
PROCEDURE_ID,
COMMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7UnknownPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Unknown Panel Category Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/snprc_ehr/HL7UnknownPivot.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT
obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID
|| '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || COALESCE(CAST(obr.MESSAGE_ID AS VARCHAR), '')
|| '-' || COALESCE(CAST(obr.PROCEDURE_ID AS VARCHAR), '')
|| '-' || COALESCE(COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME), '')
|| '-' || COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
7 changes: 7 additions & 0 deletions snprc_ehr/resources/queries/snprc_ehr/HL7Urinalysis.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="HL7UrinalysisPivot" tableDbType="NOT_IN_DB">
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table now has two customizers being applied: DefaultEHRCustomizer from the XML configuration and SNPRC_EHRCustomizer from the Java code (lines 207-212 of SNPRC_EHRCustomizer.java). Both customizers may attempt to add assignment and age columns, potentially causing conflicts or duplicate columns. Verify that these customizers work together correctly without creating duplicate calculated columns.

Suggested change
<javaCustomizer class="org.labkey.ehr.table.DefaultEHRCustomizer" />

Copilot uses AI. Check for mistakes.
<tableTitle>Urinalysis Pivot</tableTitle>
<columns>
<column columnName="Key">
<isKeyField>true</isKeyField>
<isHidden>true</isHidden>
</column>
</columns>
</table>
</tables>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT
obr.ANIMAL_ID as id,
obr.OBSERVATION_DATE_TM as date,
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key field is composed only of id and date concatenation, but the query groups by additional columns (MESSAGE_ID, PROCEDURE_NAME, PROCEDURE_ID, COMMENT) which means multiple rows can have the same key value. This will cause issues since the key field is marked as isKeyField in the query.xml file. Consider including additional distinguishing fields in the key formula to ensure uniqueness, or reconsider whether this composite key is appropriate for the data structure.

Suggested change
obr.ANIMAL_ID || '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR) as key,
obr.ANIMAL_ID
|| '-' || CAST(obr.OBSERVATION_DATE_TM AS VARCHAR)
|| '-' || CAST(obr.MESSAGE_ID AS VARCHAR)
|| '-' || CAST(obr.SET_ID AS VARCHAR)
|| '-' || COALESCE(COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME), '')
|| '-' || CAST(obr.PROCEDURE_ID AS VARCHAR)
|| '-' || COALESCE(nte.COMMENT, '') as key,

Copilot uses AI. Check for mistakes.
obr.MESSAGE_ID,
COALESCE (lp.ServiceId.ServiceName, obr.PROCEDURE_NAME) as PROCEDURE_NAME,
obr.PROCEDURE_ID,
Expand Down
10 changes: 10 additions & 0 deletions snprc_ehr/src/org/labkey/snprc_ehr/table/SNPRC_EHRCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void doSharedCustomization(AbstractTableInfo ti)
{
ti.getMutableColumn("project").setLabel("Charge Id");
}

}

public UserSchema getEHRUserSchema(AbstractTableInfo ds, String name)
Expand Down Expand Up @@ -202,6 +203,14 @@ public void doTableSpecificCustomizations(AbstractTableInfo ti)
{
customizeTasks(ti);
}

// add assignments and age to hl7 pivot tables
if (ti.getName().toLowerCase().contains("hl7") && ti.getName().toLowerCase().contains("pivot")) {
UserSchema snprc_ehrSchema = getEHRUserSchema(ti, SNPRC_EHRSchema.NAME);
appendAssignmentAtTimeColumn(snprc_ehrSchema, ti, DATE_COLUMN);
appendAgeAtTimeColumn(snprc_ehrSchema, ti, DATE_COLUMN);
}

}

/**
Expand All @@ -225,6 +234,7 @@ private void addCalculatedColumns(AbstractTableInfo table)
appendAssignmentAtTimeColumn(ehrSchema, table, DATE_COLUMN);
appendAgeAtTimeColumn(ehrSchema, table, DATE_COLUMN);
}

}

/**
Expand Down
Loading