Allow providers to file results on behalf of other providers#88
Conversation
- Add combined "Acknowledge/File Document" modal (comment + provider selection in one step) - Add separate "File Document" dialog for the "File for..." button (no comment needed) - Fix isLabNotFiledOrAckFlag not being set when logged-in provider appeared first in ackList - Improve code comments and add full flow documentation for the ack/filing feature
Reviewer's GuideRefactors the HL7 lab acknowledgement and filing UX so the main Acknowledge button now opens a combined comment+optional filing modal, introduces a dedicated File Document dialog for the "File for..." flow, and flips the isHl7OfferFileForOthers preference default from true to false with matching UI text and extensive inline documentation. Sequence diagram for the combined acknowledge/file modal flowsequenceDiagram
actor Provider
participant BrowserUI
participant LabDisplayJS
participant AppServer
Provider->>BrowserUI: Click Acknowledge button
BrowserUI->>LabDisplayJS: openFileDialog(false)
alt isFileOnly true (File for button)
LabDisplayJS->>LabDisplayJS: openFileOnlyDialog()
LabDisplayJS->>BrowserUI: Open File Document dialog fileDialog
Provider->>BrowserUI: Select providers and click Submit
BrowserUI->>LabDisplayJS: fileDialogOkButton click
LabDisplayJS->>LabDisplayJS: fileOnBehalfOfMultipleProviders(selectedProviders)
loop For each selected provider
LabDisplayJS->>AppServer: POST FileLabs.do with auto filing comment
AppServer-->>LabDisplayJS: Filing result
end
LabDisplayJS->>BrowserUI: location.reload()
BrowserUI->>Provider: Updated filing status for selected providers
else isFileOnly false and isHl7OfferFileForOthers false and or no linked providers or skipComment true
LabDisplayJS->>BrowserUI: Trigger tempAckBtn click
BrowserUI->>AppServer: handleLab acknowledgeForm ackLab or getComment then ackLab
AppServer-->>BrowserUI: Lab acknowledged
BrowserUI-->>Provider: Lab status Acknowledged
else isFileOnly false and isHl7OfferFileForOthers true and skipComment false
LabDisplayJS->>LabDisplayJS: openCombinedAckFileDialog(false)
LabDisplayJS->>BrowserUI: Open combinedAckFileDialog
BrowserUI->>Provider: Show comment field and optional provider list
Provider->>BrowserUI: Enter comment and optionally select providers
Provider->>BrowserUI: Click Submit
BrowserUI->>LabDisplayJS: combinedAckOkButton click
LabDisplayJS->>LabDisplayJS: Collect comment and selectedProviders
alt At least one provider selected
LabDisplayJS->>LabDisplayJS: fileOnBehalfOfMultipleProviders(selectedProviders)
loop For each selected provider
LabDisplayJS->>AppServer: POST FileLabs.do with auto filing comment
AppServer-->>LabDisplayJS: Filing result
end
LabDisplayJS->>AppServer: handleLab acknowledgeWithComment(comment segmentId)
AppServer-->>LabDisplayJS: Lab acknowledged
LabDisplayJS-->>BrowserUI: Update lab status
BrowserUI-->>Provider: Lab acknowledged and filed for others
else No providers selected
LabDisplayJS->>AppServer: handleLab acknowledgeWithComment(comment segmentId)
AppServer-->>LabDisplayJS: Lab acknowledged
LabDisplayJS-->>BrowserUI: Update lab status
BrowserUI-->>Provider: Lab acknowledged only
end
end
Flow diagram for openFileDialog routing and dialog behaviorsflowchart TD
Start["Click Acknowledge or File for button"]
CallOpen["Call openFileDialog(isFileOnly)"]
IsFileOnly{Is isFileOnly true?}
Start --> CallOpen --> IsFileOnly
%% File for flow
IsFileOnly -- Yes (File for) --> OpenFileOnly["openFileOnlyDialog()
Open File Document dialog fileDialog"]
OpenFileOnly --> WaitSelectFile["Provider selects providers (ackProviderCheckbox)"]
WaitSelectFile --> EnableOk["Enable fileDialogOkButton when at least one provider is checked"]
EnableOk --> SubmitFileOnly["Click Submit in File Document dialog"]
SubmitFileOnly --> FileMultiFileOnly["fileOnBehalfOfMultipleProviders(selectedProviders)"]
FileMultiFileOnly --> ParallelCallsFileOnly["Parallel POST FileLabs.do calls for each provider"]
ParallelCallsFileOnly --> ReloadFileOnly["location.reload()"]
ReloadFileOnly --> EndFileOnly["Page shows updated filing status"]
%% Acknowledge branch
IsFileOnly -- No (Acknowledge) --> CheckSkipComment{Is skipAckComment true?}
CheckSkipComment -- Yes --> TriggerTemp["Trigger tempAckBtn (ackLabFunc)"]
TriggerTemp --> LegacyAck["Legacy flow: handleLab ackLab or getComment then ackLab"]
LegacyAck --> EndLegacy["Lab acknowledged"]
CheckSkipComment -- No --> CombinedDialogPath{isHl7OfferFileForOthers true?}
CombinedDialogPath -- No --> TriggerTemp2["Trigger tempAckBtn (no combined modal)"]
TriggerTemp2 --> LegacyAck
CombinedDialogPath -- Yes --> OpenCombined["openCombinedAckFileDialog(false)
Open Acknowledge/File Document modal"]
OpenCombined --> PrefillComment["Prefill combinedAckComment from existing comment (if any)"]
PrefillComment --> OptionalAccordion["Optional accordion: show providers if eligibleProviderCount > 0"]
OptionalAccordion --> ProviderInput["Provider enters comment and optionally selects providers"]
ProviderInput --> SubmitCombined["Click Submit in combined modal"]
SubmitCombined --> HasProviders{Any providers selected?}
HasProviders -- No --> AckOnly["acknowledgeWithComment(comment segmentId)
handleLab ackLab"]
AckOnly --> EndAckOnly["Lab acknowledged only"]
HasProviders -- Yes --> FileMultiCombined["fileOnBehalfOfMultipleProviders(selectedProviders)"]
FileMultiCombined --> ParallelCallsCombined["Parallel POST FileLabs.do calls for each provider"]
ParallelCallsCombined --> AckAfterFile["acknowledgeWithComment(comment segmentId)
handleLab ackLab"]
AckAfterFile --> EndCombined["Lab acknowledged and filed for selected providers"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the combined acknowledge/file modal,
eligibleProviderCountis incremented for any non-self, non-F/A provider regardless of theirhl7AllowOthersFileForYousetting, which means the accordion can appear even when all providers are disabled; consider basing the count only on providers who have actually allowed filing so the optional section is hidden when there are no selectable targets. - The CSS rules that style dialogs via
.ui-dialog:has(#fileDialog)and.ui-dialog:has(#combinedAckFileDialog)rely on the:has()selector, which is not supported in some browsers; if you need broader compatibility, you may want to switch to a class-based approach applied in the dialog open callbacks instead of:has(). - The
openCombinedAckFileDialog(isFileOnly)function and its button logic include a code path forisFileOnly=true, but all callers currently invoke it only withfalse(file-only usesopenFileOnlyDialog()), so you could simplify by removing the unusedisFileOnlyparameter/branches until you actually need combined file-only behaviour.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the combined acknowledge/file modal, `eligibleProviderCount` is incremented for any non-self, non-F/A provider regardless of their `hl7AllowOthersFileForYou` setting, which means the accordion can appear even when all providers are disabled; consider basing the count only on providers who have actually allowed filing so the optional section is hidden when there are no selectable targets.
- The CSS rules that style dialogs via `.ui-dialog:has(#fileDialog)` and `.ui-dialog:has(#combinedAckFileDialog)` rely on the `:has()` selector, which is not supported in some browsers; if you need broader compatibility, you may want to switch to a class-based approach applied in the dialog open callbacks instead of `:has()`.
- The `openCombinedAckFileDialog(isFileOnly)` function and its button logic include a code path for `isFileOnly=true`, but all callers currently invoke it only with `false` (file-only uses `openFileOnlyDialog()`), so you could simplify by removing the unused `isFileOnly` parameter/branches until you actually need combined file-only behaviour.
## Individual Comments
### Comment 1
<location path="src/main/webapp/lab/CA/ALL/labDisplay.jsp" line_range="1215-1226" />
<code_context>
+ const textEl = document.getElementById(providerNo + "_" + segmentId + "commentText");
+ jQuery("#combinedAckComment").val(textEl ? textEl.innerHTML : "");
+
+ // Persist isFileOnly on the dialog element so the checkbox change handler can read it
+ // without it needing to be in scope as a closure variable.
+ jQuery("#combinedAckFileDialog").data("isFileOnly", isFileOnly);
+
+ jQuery("#combinedAckFileDialog").dialog({
</code_context>
<issue_to_address>
**suggestion:** Remove unused isFileOnly dialog data or wire it up where needed
`isFileOnly` is written to `#combinedAckFileDialog` via `.data("isFileOnly", ...)` but never read. Since `openCombinedAckFileDialog` already uses the `isFileOnly` parameter directly, this looks redundant. Either remove the `.data(...)` call, or add the code that actually reads this value if a handler needs it.
```suggestion
function openCombinedAckFileDialog(isFileOnly) {
const segmentId = jQuery("#segmentID").val();
// Pre-populate the comment field with any comment the provider has already saved for this lab.
const textEl = document.getElementById(providerNo + "_" + segmentId + "commentText");
jQuery("#combinedAckComment").val(textEl ? textEl.innerHTML : "");
jQuery("#combinedAckFileDialog").dialog({
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| function openCombinedAckFileDialog(isFileOnly) { | ||
| const segmentId = jQuery("#segmentID").val(); | ||
|
|
||
| // Pre-populate the comment field with any comment the provider has already saved for this lab. | ||
| const textEl = document.getElementById(providerNo + "_" + segmentId + "commentText"); | ||
| jQuery("#combinedAckComment").val(textEl ? textEl.innerHTML : ""); | ||
|
|
||
| // Persist isFileOnly on the dialog element so the checkbox change handler can read it | ||
| // without it needing to be in scope as a closure variable. | ||
| jQuery("#combinedAckFileDialog").data("isFileOnly", isFileOnly); | ||
|
|
||
| jQuery("#combinedAckFileDialog").dialog({ |
There was a problem hiding this comment.
suggestion: Remove unused isFileOnly dialog data or wire it up where needed
isFileOnly is written to #combinedAckFileDialog via .data("isFileOnly", ...) but never read. Since openCombinedAckFileDialog already uses the isFileOnly parameter directly, this looks redundant. Either remove the .data(...) call, or add the code that actually reads this value if a handler needs it.
| function openCombinedAckFileDialog(isFileOnly) { | |
| const segmentId = jQuery("#segmentID").val(); | |
| // Pre-populate the comment field with any comment the provider has already saved for this lab. | |
| const textEl = document.getElementById(providerNo + "_" + segmentId + "commentText"); | |
| jQuery("#combinedAckComment").val(textEl ? textEl.innerHTML : ""); | |
| // Persist isFileOnly on the dialog element so the checkbox change handler can read it | |
| // without it needing to be in scope as a closure variable. | |
| jQuery("#combinedAckFileDialog").data("isFileOnly", isFileOnly); | |
| jQuery("#combinedAckFileDialog").dialog({ | |
| function openCombinedAckFileDialog(isFileOnly) { | |
| const segmentId = jQuery("#segmentID").val(); | |
| // Pre-populate the comment field with any comment the provider has already saved for this lab. | |
| const textEl = document.getElementById(providerNo + "_" + segmentId + "commentText"); | |
| jQuery("#combinedAckComment").val(textEl ? textEl.innerHTML : ""); | |
| jQuery("#combinedAckFileDialog").dialog({ |
… on-behalf filing
…viders() with no args, which always rejected and blocked the acknowledge flow - Fix duplicate-ID DOM lookups by passing segmentId/labType as parameters through openFileDialog → openFileOnlyDialog/openCombinedAckFileDialog → fileOnBehalfOfMultipleProviders instead of reading #segmentID/#labType - Remove duplicate loggedInProviderNo/loggedInProviderName hidden inputs inside fileDialog loop that broke jQuery ID uniqueness
|
Closing this for now since there's still work to be done in the original branch. |
Status Quo
Currently, a logged-in provider cannot file lab results on behalf of another provider.
Change
We have added functionality to allow a provider to file results on behalf of other providers.
(Example shown logged in as
doctor oscardoc.)Important
This PR is designed to minimize support burden on OpenOSP.
Main Workflow
Case 1: 0 or 1 provider attached to the lab:
Acknowledgeopens the updated acknowledgement dialog, but no file options are shown.Case 2: More than 1 provider attached to the lab:
Clicking
Acknowledgeopens a combined modal where the user selects providers to file for and adds an acknowledgement comment.User adds comment and selects providers to file on their behalf, then clicks
Submit.After confirmation, the UI updates accordingly:
Preferences
Providers can configure the behavior under Preferences:
Control the file dialog accordion
Toggle the option:
"Automatically offer to file results on behalf of other providers when acknowledging HL7 lab results"
Prevent others from filing on your behalf
Turn off the option:
"Allow other providers to file results on your behalf when they acknowledge HL7 lab results"
Additional Features
Even if a user has already acknowledged a lab, they can still file it for other providers using the
File for…button.If the provider has acknowledged version 1 and, after some time, version 2 is released.
