diff --git a/onprc_billing/resources/etls/PublicInvoices.xml b/onprc_billing/resources/etls/PublicInvoices.xml deleted file mode 100644 index 2a41bbbb3..000000000 --- a/onprc_billing/resources/etls/PublicInvoices.xml +++ /dev/null @@ -1,14 +0,0 @@ - - publicInvoicedItems - Copies Invoiced Items to Public Folder, access controlled by dataAccess - - - Truncate and Populate InvoicedItems - - - - - - - - diff --git a/onprc_ehr/resources/etls/UpdateEhrProtocols.xml b/onprc_ehr/resources/etls/UpdateEhrProtocols.xml deleted file mode 100644 index 9ddf6dec9..000000000 --- a/onprc_ehr/resources/etls/UpdateEhrProtocols.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Update Protocols in EHR - - Runs stored procedures to update the protocol table in schema ehr. - - - - - Determines and populates BaseProtocol and RevisionNumber data for the protocol table in schema onprc_ehr. - - - - - - Adds enddate data to the protocol table in ehr. - - - - - - - - - - - - - diff --git a/onprc_ehr/resources/etls/mfshtoRandalData_2024.xml b/onprc_ehr/resources/etls/mfshtoRandalData_2024.xml deleted file mode 100644 index 5bc8a444e..000000000 --- a/onprc_ehr/resources/etls/mfshtoRandalData_2024.xml +++ /dev/null @@ -1,105 +0,0 @@ - - mfshToRandalData_2024 - imports the data from mfsh animal details on ONPRC - - - Define Hansen Study Animals 2022 - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share Project - - - - - Export Query to File Share Protocols - - - - - Export Query to File Share - - - - - - - - - \ No newline at end of file diff --git a/onprc_ehr/resources/etls/mfshtoRandalData_2024_01.xml b/onprc_ehr/resources/etls/mfshtoRandalData_2024_01.xml deleted file mode 100644 index 27c3886ac..000000000 --- a/onprc_ehr/resources/etls/mfshtoRandalData_2024_01.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - mfshToRandalData_2024 - imports the data from mfsh animal details on ONPRC - - - Define Hansen Study Animals 2022 - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share - - - - - Export Query to File Share Project - - - - - Export Query to File Share Protocols - - - - - Export Query to File Share - - - - - - - - - \ No newline at end of file diff --git a/onprc_ehr/resources/etls/ogaAliasCleanup2020.xml b/onprc_ehr/resources/etls/ogaAliasCleanup2020.xml deleted file mode 100644 index efccb1e45..000000000 --- a/onprc_ehr/resources/etls/ogaAliasCleanup2020.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - ogaAliasCleanUp2020 - - Code to enddate or remove Aliases not Assocatied with ONPRC - - - - - Code to enddate or remove Aliases not Assocatied with ONPRC. - - - - - - - - - - - diff --git a/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.sql b/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.sql new file mode 100644 index 000000000..dcdc8413e --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.sql @@ -0,0 +1,115 @@ +/* +===================================================================== + Query Name : GJ_BillingDiscrepanciesRL + Schema : onprc_ehr + Purpose : Identify procedure charges where the billed project + does not match the animal’s current project and + highlight animals with dual active assignments. + Issue / Ticket : EHR Issue 11870 + Author : jonesga + Last Modified : 2026-07-15 +update" Deploying to Test F for review +===================================================================== +*/ + +WITH ProcedureFees AS ( + SELECT + pfr.id, + pfr.date, + pfr.project.displayName AS ProjectBilledTo, + pfr.project AS billedProjectObj, + pfr.chargeType, + pfr.procedureId, + pfr.chargeId, + pfr.unitCost, + pfr.matchesProject, + pfr.taskId + FROM onprc_billing.procedureFeeRates pfr +) +, +/*------------------------------------------------------------------- + Active assignment context +-------------------------------------------------------------------*/ + ActiveAssignments AS ( + SELECT + a.Id, + a.project, + a.project.displayName AS ProjectName + FROM study.assignment a + WHERE + (a.enddate IS NULL OR a.enddate >= CURDATE()) + AND a.date = ( + SELECT MAX(a2.date) + FROM study.assignment a2 + WHERE a2.Id = a.Id + AND (a2.enddate IS NULL OR a2.enddate >= CURDATE()) + ) + ), + + AssignmentCounts AS ( + SELECT + Id, + COUNT(DISTINCT project) AS AssignmentCount + FROM ActiveAssignments + GROUP BY Id + ), + + AnimalAssignmentStatus AS ( + SELECT + aa.Id, + aa.ProjectName AS CurrentProject, + ac.AssignmentCount, + CASE + WHEN ac.AssignmentCount > 1 THEN true + ELSE false + END AS IsDualAssigned + FROM ActiveAssignments aa + LEFT JOIN AssignmentCounts ac + ON aa.Id = ac.Id + ) + +/*------------------------------------------------------------------- + Final result +-------------------------------------------------------------------*/ +SELECT + pf.id, + pf.date, + + pf.ProjectBilledTo, + aas.CurrentProject, + + + + CASE + WHEN pf.ProjectBilledTo = aas.CurrentProject + OR aas.CurrentProject IS NULL + THEN 'Billing is Correct' + ELSE 'Billing Needs Review' + END AS ChargeReview, + + /* CASE + WHEN aas.IsDualAssigned = true + THEN 'Dual Assigned' + ELSE 'Single Assignment' + END AS AssignmentStatus,*/ + + + pf.chargeType, + pf.procedureId, + pf.chargeId, + pf.unitCost, + pf.matchesProject, + pf.taskId + +FROM ProcedureFees pf + LEFT JOIN AnimalAssignmentStatus aas + ON pf.id = aas.Id + +WHERE + pf.ProjectBilledTo NOT LIKE '0492' + --or + --AND aas.IsDualAssigned = true) + +ORDER BY + pf.date DESC, + pf.id; \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.xml b/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.xml new file mode 100644 index 000000000..b44051b69 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/BillingDiscrepancyforR_L.xml @@ -0,0 +1,79 @@ + + + + + + + + DaysBack + + int + true + 1 + + Number of prior days to include in the review window. + Valid values are 1 through 30. + + + + + + + + + + + ProjectBilledTo + + + The project to which the procedure charge was billed. + + + + + CurrentProject + + + The animal’s current active project at the time of review. + + + + + + ChargeReview + + + + + + + equals + Billing is Correct + #2E7D32 + #FFD700 + + + + + equals + Billing Needs Review + #C62828 + #FFFFFF + bold + + + + + + + + + + unitCost + + $#,##0.00 + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/gdj_BillingDiscrepancyforR_L.xml b/onprc_ehr/resources/queries/onprc_ehr/gdj_BillingDiscrepancyforR_L.xml new file mode 100644 index 000000000..5ca9bae50 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/gdj_BillingDiscrepancyforR_L.xml @@ -0,0 +1,124 @@ + + + + + + + + DaysBack + + int + true + 1 + + Number of prior days to include in the review window. + Valid values are 1 through 30. + Example: 7 = review the last 7 days. + + + + + + + + + + ProjectBilledTo + + + The project to which the procedure charge will be billed. + + + + + CurrentProject + + + The animal’s current active project at the time of review. + + + + + ChargeReview + + + Indicates whether the billed project matches the animal’s + current project. Records marked with a red X require review. + + + + + DaysBackUsed + + + The actual number of days included in this run after + validation and bounds enforcement. + + + + + unitCost + + $#,##0.00 + + + + + + + + + + ChargeReview + equals + ❌ Billing Needs Review + #F8D7DA + #721C24 + + + + ChargeReview + equals + ✅ Billing is Correct + #D4EDDA + #155724 + + + + + + + + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/schemas/dbscripts/rl_financeData.template.xml b/onprc_ehr/resources/schemas/dbscripts/rl_financeData.template.xml new file mode 100644 index 000000000..91af220bc --- /dev/null +++ b/onprc_ehr/resources/schemas/dbscripts/rl_financeData.template.xml @@ -0,0 +1,17 @@ + + + + investigators + procedureFeeRates + + + + + + + + Investigators +
+
+
+
\ No newline at end of file