-
Notifications
You must be signed in to change notification settings - Fork 68
RELEASE healthie support group sessions #3974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Ref: ENG-82 Ref: #1040 Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
Ref: ENG-82 Ref: #1040 Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
Ref: ENG-82 Ref: #1040 Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
Ref: ENG-82 Ref: #1040 Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
… 1040-patch-healthie Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
Ref: ENG-00 Ref: #1040 Signed-off-by: Thomas Yopes <thomasyopes@Thomass-MBP.attlocal.net>
feat(healthie): supporting group sessions
WalkthroughThe changes update the handling of Healthie appointment attendees to support multiple patients per appointment instead of just one. This includes renaming functions, updating return types, modifying processing logic to iterate over all attendees, and adjusting array construction to include all attendees rather than just the first. Changes
Sequence Diagram(s)sequenceDiagram
participant Webhook as Appointment Webhook
participant API as Healthie API
participant Handler as Patient Sync Handler
Webhook->>API: getHealthiePatientsFromAppointment(appointmentId)
API-->>Webhook: [patientId1, patientId2, ...]
alt No patient IDs
Webhook-->>Webhook: Return early
else Patient IDs found
loop For each patientId
Webhook->>Handler: updatePatientQuickNotes(patientId)
Webhook->>Handler: syncPatientWithEhrSource(patientId)
end
end
Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error code ERR_SSL_WRONG_VERSION_NUMBER ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/core/src/external/ehr/healthie/index.ts (2)
292-297
: Simplify attendees array handling.The current implementation reconstructs the attendees array as
[attendee, ...appointment.attendees.slice(1)]
whereattendee
isappointment.attendees[0]
. This is functionally equivalent to the originalappointment.attendees
array.Consider simplifying to:
- return [ - { - ...appointment, - attendees: [attendee, ...appointment.attendees.slice(1)], - }, - ]; + return [{ ...appointment }];If there's a specific reason for the array reconstruction, please add a comment explaining the intent.
353-353
: Simplify attendees array handli 8000 ng.Same issue as in the pagination helper - the attendees array reconstruction is unnecessary.
- return { ...appointment, attendees: [attendee, ...appointment.attendees.slice(1)] }; + return appointment;packages/api/src/external/ehr/healthie/command/get-patients-from-appointment.ts (1)
4-4
: Consider updating the type name for consistency.The type name
GetHealthiePatientFromAppointmentParams
uses singular "Patient" but the function now handles multiple patients. Consider renaming for clarity.-export type GetHealthiePatientFromAppointmentParams = { +export type GetHealthiePatientsFromAppointmentParams = {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/api/src/external/ehr/healthie/command/get-patients-from-appointment.ts
(1 hunks)packages/api/src/external/ehr/healthie/command/process-patients-from-appointments.ts
(1 hunks)packages/api/src/routes/ehr/healthie/appointment-webhook.ts
(2 hunks)packages/core/src/external/ehr/healthie/index.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.ts`: - Use the Onion Pattern to organize a package's code in layers - Try to use immutable code and avoid sharing state across different functions, objects, and systems - Try...
**/*.ts
: - Use the Onion Pattern to organize a package's code in layers
- Try to use immutable code and avoid sharing state across different functions, objects, and systems
- Try to build code that's idempotent whenever possible
- Prefer functional programming style functions: small, deterministic, 1 input, 1 output
- Minimize coupling / dependencies
- Avoid modifying objects received as parameter
- Only add comments to code to explain why something was done, not how it works
- Naming
- classes, enums:
PascalCase
- constants, variables, functions:
camelCase
- file names:
kebab-case
- table and column names:
snake_case
- Use meaningful names, so whoever is reading the code understands what it means
- Don’t use negative names, like
notEnabled
, preferisDisabled
- For numeric values, if the type doesn’t convey the unit, add the unit to the name
- Typescript
- Use types
- Prefer
const
instead oflet
- Avoid
any
and casting fromany
to other types- Type predicates: only applicable to narrow down the type, not to force a complete type conversion
- Prefer deconstructing parameters for functions instead of multiple parameters that might be of
the same type- Don’t use
null
inside the app, only on code interacting with external interfaces/services,
like DB and HTTP; convert toundefined
before sending inwards into the code- Use
async/await
instead of.then()
- Use the strict equality operator
===
, don’t use abstract equality operator==
- When calling a Promise-returning function asynchronously (i.e., not awaiting), use
.catch()
to
handle errors (seeprocessAsyncError
andemptyFunction
depending on the case)- Date and Time
- Always use
buildDayjs()
to createdayjs
instances- Prefer
dayjs.duration(...)
to create duration consts and keep them asduration
- Prefer Nullish Coalesce (??) than the OR operator (||) to provide a default value
- Avoid creating arrow functions
- Use truthy syntax instead of
in
- i.e.,if (data.link)
notif ('link' in data)
- Error handling
- Pass the original error as the new one’s
cause
so the stack trace is persisted- Error messages should have a static message - add dynamic data to MetriportError's
additionalInfo
prop- Avoid sending multiple events to Sentry for a single error
- Global constants and variables
- Move literals to constants declared after imports when possible (avoid magic numbers)
- Avoid shared, global objects
- Avoid using
console.log
andconsole.error
in packages other than utils, infra and shared,
and try to useout().log
instead- Avoid multi-line logs
- don't send objects as a second parameter to
console.log()
orout().log()
- don't create multi-line strings when using
JSON.stringify()
- Use
eslint
to enforce code style- Use
prettier
to format code- max column length is 100 chars
- multi-line comments use
/** */
- scripts: top-level comments go after the import
packages/api/src/external/ehr/healthie/command/process-patients-from-appointments.ts
packages/core/src/external/ehr/healthie/index.ts
packages/api/src/routes/ehr/healthie/appointment-webhook.ts
packages/api/src/external/ehr/healthie/command/get-patients-from-appointment.ts
🧬 Code Graph Analysis (1)
packages/api/src/routes/ehr/healthie/appointment-webhook.ts (1)
packages/api/src/external/ehr/healthie/command/get-patients-from-appointment.ts (1)
getHealthiePatientsFromAppointment
(11-24)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: check-pr / lint-build-test
- GitHub Check: check-pr / lint-build-test
- GitHub Check: Analyze (javascript)
- GitHub Check: ihe_stack / deploy
- GitHub Check: infra-api-lambdas / deploy
- GitHub Check: mllp-server / deploy
- GitHub Check: api / deploy
- GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/api/src/external/ehr/healthie/command/process-patients-from-appointments.ts (1)
187-191
: LGTM! Correctly implements multi-patient support per appointment.The change from processing only the first attendee to processing all attendees is well-implemented using
flatMap
andmap
. This creates a separate entry for each attendee-appointment pair, which aligns with the PR objective of supporting group sessions with multiple patients.packages/api/src/routes/ehr/healthie/appointment-webhook.ts (2)
10-10
: LGTM! Import updated to handle multiple patients.The import change from
getHealthiePatientFromAppointment
togetHealthiePatientsFromAppointment
correctly reflects the new multi-patient support.
46-69
: LGTM! Webhook logic correctly handles multiple patients per appointment.The implementation properly:
- Fetches all patient IDs from the appointment
- Handles the empty case with early return
- Processes each patient individually for quick notes updates and synchronization
- Respects the
webhookAppointmentPatientProcessingDisabled
flag per patientpackages/api/src/external/ehr/healthie/command/get-patients-from-appointment.ts (3)
11-11
: LGTM! Function name appropriately reflects multi-patient support.The rename from
getHealthiePatientFromAppointment
togetHealthiePatientsFromAppointment
correctly indicates that the function now handles multiple patients.
16-16
: LGTM! Return type correctly updated for multi-patient support.The change from
Promise<string | undefined>
toPromise<string[]>
appropriately reflects the new behavior of returning multiple patient IDs.
22-23
: LGTM! Logic correctly handles multiple attendees.The updated logic properly:
- Returns an empty array when no appointment is found (better than
undefined
for consistency)- Maps all attendee IDs instead of just the first one
Issues:
Description
Testing
Check each PR.
Release Plan
master
Summary by CodeRabbit
New Features
Bug Fixes
Refactor