Skip to content

Conversation

@marythought
Copy link
Contributor

@marythought marythought marked this pull request as draft June 4, 2025 03:49
@marythought marythought requested a review from Copilot June 4, 2025 03:50

This comment was marked as outdated.

@marythought marythought self-assigned this Jun 4, 2025
@marythought marythought added the enhancement New feature or request label Jun 4, 2025
@marythought marythought requested a review from Copilot June 4, 2025 04:06

This comment was marked as outdated.

Copy link

Copilot AI left a 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_TO to include contact-point events and refactors compute() to handle them
  • Implements get_patient_id() for resolving patient IDs from contact-point events
  • Introduces BridgePatientSyncApi with a POST /routes/patients endpoint
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_url will throw an IndexError if url is an empty string. Consider validating input length first or using url.rstrip('/').
def sanitize_url(self, url):

extensions/bridge/protocols/bridge_patient_sync.py:169

  • [nitpick] The new BridgePatientSyncApi class and its post method 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,
Copy link

Copilot AI Jun 4, 2025

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.

Suggested change
'telecom': contact_point if contact_point else None,
'telecom': telecom,

Copilot uses AI. Check for mistakes.
@marythought
Copy link
Contributor Author

replaced by #154

@marythought marythought closed this Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants