AI prompt pipeline implemented#2467
Conversation
…echanism that was only used to archive re-staged medications after re-editing
…th CSRF and POST fetch, update JSDoc to align with uncheckReRxForExistingPrescribedDrug parameters
…o searchDrug3.jsp, updated javadoc in delete action, added drugList null or empty check
… instead of a reference
Unchecking a ReRx checkbox after staging failed to remove the UI card because removeDrugFromReRxList looked up the card by prescription ID (set_<prescriptIdInt>) but the card uses a randomId (set_<randomId>). Added data-drug-ref-id attribute to staged card fieldsets and updated the lookup to use querySelector with that attribute.
Relabel existing FTLS field from Monofilament 10g to Neurological exam: 10g monofilament and add new NRTF measurement Neurological exam: 128Hz tuning fork D1 to all three diabetes flowsheets (diab, diab2, diab3) to meet OMD DE16.066 compliance.
…e with the corresponding ticket
…and initial test data to be replaced with the new data added into ctl_billingservice, archived if using migration file to avoid removing anything that uses the same values that are not test data
… resolution order, add eclipse ide files to gitignore file
…checking-and-forward-iteration-deletion-loop-medications Fix: String object comparison and forward-iteration deletion in medication stash, missing GCN_SEQNO for drug search flow, and drug name encoding on input
…asses-wrong-id-unmasks-archival-bug Fix: medication X button passes wrong ID and removed flawed archival mechanism that was only used to archive re-staged medications after re-editing
…checking-removes-only-server-side-stash-entry Fix: resolve ghost card when unchecking ReRx checkbox after staging
…t-script-reload fix: MDS queue doc count not updating after Save & Next
… DataTables upgrade
…-fork-measurement-diabetes-flowsheet Fix: missing tuning fork measurement diabetes flowsheet
…anged to be in ascending order instead of previous descending order)
…ate to match original behaviour instead of enetered date
… Date is unknown, to match the previous server side sorting behaviour
…age data changing the default sort order, since changes have not been added to prod, so this issue doesn't currently cause issues
…r-erase-selected-coimpletely-not-working Fix: Tickler Manager - "Erase Selected Completely" button doesn't work
…tions-field-reference-rx-cannot-be-closed Fix: The Instructions Field Reference popup in the Rx module cannot be closed
…rofile-view-legend-searchdrug3 fix: restore drug profile legend and filter tab functionality broken by DataTables upgrade
…each medication, and underlines on specifically singular medication reprints
…-no-longer-works Fix: "Reprint" button in Rx module no longer works
…ion-list-rx-module-wrong-order Fix: Medication list in rx module is sorted in the wrong order
…rendering-and-missing-labels fix: restore <br> rendering and fix missing labels in RxPreview
…on and more, updated spring for api intiailization
merging changes from my branch
OCR and caching implemented, adjusted LLM endpoint to send data in json.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Sorry @idkcoder93, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this comment.
Code Review
This pull request introduces an AI-ready patient export feature, including a new REST endpoint (/llm/export), an extraction service (LLMExtractorService), and a two-layer caching mechanism (LlmDocumentTextService) for extracted PDF text. It also adds attachment validation for Ocean eReferrals, introduces the NRTF measurement type for diabetes flowsheet compliance, and refactors client-side drug profile filtering and Tickler restore actions. The review feedback highlights several robustness improvements, including converting a query parameter to a string to avoid type mismatches, adding defensive null checks for array parameters and note results, handling potential parsing exceptions for demographic numbers, and correcting a cache sentinel return value mismatch.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
5 issues found across 56 files
Confidence score: 2/5
- Multiple high-confidence, user-impacting issues are present (sev 6–7), including historical data misclassification in
src/main/resources/oscar/oscarEncounter/oscarMeasurements/flowsheets/diabetesQueensFlowsheet.xmland invalid document payloads being accepted insrc/main/java/ca/openosp/openo/documentManager/DocumentAttachmentManagerImpl.java, which makes this a high-risk merge. src/main/webapp/js/custom/ocean/conreq.jsuses synchronous AJAX (async: false), which can block the browser UI during attachment validation and cause hung referral workflows.src/main/java/ca/openosp/openo/encounter/oceanEReferal/pageUtil/ERefer2Action.javacan throwNumberFormatExceptionfor malformeddemographicNo, andsrc/main/java/ca/openosp/openo/managers/LlmDocumentTextService.javareturns""instead ofnullon cache hits, creating request-failure and contract-consistency risks.- Pay close attention to
src/main/resources/oscar/oscarEncounter/oscarMeasurements/flowsheets/diabetesQueensFlowsheet.xml,src/main/java/ca/openosp/openo/documentManager/DocumentAttachmentManagerImpl.java,src/main/webapp/js/custom/ocean/conreq.js,src/main/java/ca/openosp/openo/encounter/oceanEReferal/pageUtil/ERefer2Action.java,src/main/java/ca/openosp/openo/managers/LlmDocumentTextService.java- they contain the highest-impact correctness, validation, and UX stability risks.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main/java/ca/openosp/openo/documentManager/DocumentAttachmentManagerImpl.java">
<violation number="1" location="src/main/java/ca/openosp/openo/documentManager/DocumentAttachmentManagerImpl.java:686">
P1: Malformed or unknown document tokens are silently skipped in validateDocumentsBelongToPatient, allowing invalid payloads to incorrectly return true.</violation>
</file>
<file name="src/main/webapp/js/custom/ocean/conreq.js">
<violation number="1" location="src/main/webapp/js/custom/ocean/conreq.js:41">
P1: Synchronous AJAX (`async: false`) blocks the UI thread during attachment validation, risking frozen/hung referral interactions.</violation>
</file>
<file name="src/main/java/ca/openosp/openo/encounter/oceanEReferal/pageUtil/ERefer2Action.java">
<violation number="1" location="src/main/java/ca/openosp/openo/encounter/oceanEReferal/pageUtil/ERefer2Action.java:126">
P2: Handle invalid `demographicNo` values before parsing; a malformed request can currently throw `NumberFormatException` and fail the request.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| switch (type) { | ||
| case 'D': docIds.add(id); break; | ||
| case 'L': labIds.add(id); break; | ||
| case 'E': eformIds.add(id); break; | ||
| case 'H': hrmIds.add(id); break; |
There was a problem hiding this comment.
P1: Malformed or unknown document tokens are silently skipped in validateDocumentsBelongToPatient, allowing invalid payloads to incorrectly return true.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/java/ca/openosp/openo/documentManager/DocumentAttachmentManagerImpl.java, line 686:
<comment>Malformed or unknown document tokens are silently skipped in validateDocumentsBelongToPatient, allowing invalid payloads to incorrectly return true.</comment>
<file context>
@@ -663,4 +669,48 @@ public void flattenPDFFormFields(Path pdfPath) throws PDFGenerationException {
+ char type = doc.charAt(0);
+ try {
+ int id = Integer.parseInt(doc.substring(1));
+ switch (type) {
+ case 'D': docIds.add(id); break;
+ case 'L': labIds.add(id); break;
</file context>
| switch (type) { | |
| case 'D': docIds.add(id); break; | |
| case 'L': labIds.add(id); break; | |
| case 'E': eformIds.add(id); break; | |
| case 'H': hrmIds.add(id); break; | |
| switch (type) { | |
| case 'D': docIds.add(id); break; | |
| case 'L': labIds.add(id); break; | |
| case 'E': eformIds.add(id); break; | |
| case 'H': hrmIds.add(id); break; | |
| default: return false; | |
| } |
| let valid = false; | ||
| jQuery.ajax({ | ||
| type: 'POST', | ||
| async: false, |
There was a problem hiding this comment.
P1: Synchronous AJAX (async: false) blocks the UI thread during attachment validation, risking frozen/hung referral interactions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/webapp/js/custom/ocean/conreq.js, line 41:
<comment>Synchronous AJAX (`async: false`) blocks the UI thread during attachment validation, risking frozen/hung referral interactions.</comment>
<file context>
@@ -34,20 +34,38 @@ jQuery(document).ready(function () {
+ let valid = false;
+ jQuery.ajax({
+ type: 'POST',
+ async: false,
+ url: document.getElementById("contextPath").value + '/oscarEncounter/eRefer.do',
+ data: "demographicNo=" + demographicNo + "&method=validateDocuments&" + jQuery.param({documents: docs}, true),
</file context>
| boolean valid = documentAttachmentManager.validateDocumentsBelongToPatient( | ||
| loggedInInfo, Integer.parseInt(demographicNo), documents); | ||
| writeResponse(valid); |
There was a problem hiding this comment.
P2: Handle invalid demographicNo values before parsing; a malformed request can currently throw NumberFormatException and fail the request.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/java/ca/openosp/openo/encounter/oceanEReferal/pageUtil/ERefer2Action.java, line 126:
<comment>Handle invalid `demographicNo` values before parsing; a malformed request can currently throw `NumberFormatException` and fail the request.</comment>
<file context>
@@ -92,11 +94,40 @@ public String execute() {
+ writeResponse(true);
+ return;
+ }
+ boolean valid = documentAttachmentManager.validateDocumentsBelongToPatient(
+ loggedInInfo, Integer.parseInt(demographicNo), documents);
+ writeResponse(valid);
</file context>
| boolean valid = documentAttachmentManager.validateDocumentsBelongToPatient( | |
| loggedInInfo, Integer.parseInt(demographicNo), documents); | |
| writeResponse(valid); | |
| try { | |
| int demoNo = Integer.parseInt(demographicNo); | |
| boolean valid = documentAttachmentManager.validateDocumentsBelongToPatient( | |
| loggedInInfo, demoNo, documents); | |
| writeResponse(valid); | |
| } catch (NumberFormatException e) { | |
| writeResponse(false); | |
| } |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: idkcoder93 <113472355+idkcoder93@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
….java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: idkcoder93 <113472355+idkcoder93@users.noreply.github.com>
…e.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: idkcoder93 <113472355+idkcoder93@users.noreply.github.com>
added link to our AI prompter
This PR implements the OCR and data processing pipeline, including context windowing to improve LLM ingestion accuracy. It also adds an LLM endpoint for extracting patient data from processed documents.
Changes:
Summary by cubic
Implements an OCR + PDF text caching pipeline with context windowing and a new
/llm/exportendpoint to return patient data for LLM processing. Adds an “AI Summary” link in Chart Notes to open the prompter for the current patient.New Features
llm_document_textkeyed by SHA-256; bulk loads per patient./llm/exportreturns demographics, meds, allergies, measurements, labs, documents, and notes as JSON.Migration
llm_document_textand add new codes:LLMExtractorEndpointis registered via Spring.Written for commit c22f7fd. Summary will update on new commits.