-
Notifications
You must be signed in to change notification settings - Fork 40
Support bidirectional patient updates in Bridge plugin #148
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
Support bidirectional patient updates in Bridge plugin #148
Conversation
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.
Pull Request Overview
Adds support for bidirectional sync of patient contact points and exposes a simple API endpoint for creating patients via the Bridge plugin.
- Expands
RESPONDS_TOto include contact-point events and refactorscompute()to handle them - Implements
get_patient_id()for resolving patient IDs from contact-point events - Introduces
BridgePatientSyncApiwith aPOST /routes/patientsendpoint
Comments suppressed due to low confidence (3)
extensions/bridge/protocols/bridge_patient_sync.py:179
- Returning
str(patient)will produce a model representation, not structured JSON. Return a dict with explicit patient fields or serialize the model to JSON.
return [ JSONResponse( content=str(patient), status_code=HTTPStatus.CREATED).apply() ]
extensions/bridge/protocols/bridge_patient_sync.py:165
sanitize_urlwill throw an IndexError ifurlis an empty string. Consider validating input length first or usingurl.rstrip('/').
def sanitize_url(self, url):
extensions/bridge/protocols/bridge_patient_sync.py:169
- [nitpick] The new
BridgePatientSyncApiclass and itspostmethod lack unit or integration tests. Add tests to cover valid and invalid payloads.
class BridgePatientSyncApi(SimpleAPI):
| 'lastName': canvas_patient.last_name, | ||
| 'dateOfBirth': canvas_patient.birth_date.isoformat(), | ||
| 'dateOfBirth': canvas_patient.birth_date.isoformat(), | ||
| 'telecom': contact_point if contact_point else None, |
Copilot
AI
Jun 4, 2025
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.
Passing the ORM object contact_point directly into the JSON payload will likely fail serialization; extract only the necessary primitive fields (e.g., phone number or type) before sending.
| 'telecom': contact_point if contact_point else None, | |
| 'telecom': telecom, |
|
replaced by #154 |
Internal tracking: https://canvasmedical.atlassian.net/browse/KOALA-2895