Skip to content
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

Refactor update patient #525

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Refactor update patient #525

merged 3 commits into from
Nov 20, 2024

Conversation

sharlotta93
Copy link
Contributor

@sharlotta93 sharlotta93 commented Nov 19, 2024

PR Type

Enhancement, Tests


Description

  • Added optional dob field to the createPatient action and updated related validation and payload structures.
  • Introduced resend_welcome_email option in the updatePatient action, allowing resending of welcome emails.
  • Refactored updatePatient logic to use validatePayloadAndCreateSdk for improved validation and SDK initialization.
  • Enhanced tests for updatePatient to cover new validation logic and refactored to use the new SDK.
  • Fixed typos in test descriptions for createPatient.

Changes walkthrough 📝

Relevant files
Enhancement
fields.ts
Add optional date of birth field to patient creation         

extensions/healthie/actions/createPatient/config/fields.ts

  • Added optional dob field to patient creation.
  • Updated validation schema to include dob.
  • Modified CreatePatientPayload to include dob.
  • +9/-0     
    createPatient.ts
    Include date of birth in createPatient payload                     

    extensions/healthie/actions/createPatient/createPatient.ts

    • Added dob to the patient creation payload.
    +3/-0     
    fields.ts
    Add resend welcome email option to updatePatient                 

    extensions/healthie/actions/updatePatient/config/fields.ts

  • Added resend_welcome_email field.
  • Updated UpdatePatientPayload and validation schema.
  • +41/-1   
    index.ts
    Export FieldsValidationSchema for updatePatient                   

    extensions/healthie/actions/updatePatient/config/index.ts

    • Exported FieldsValidationSchema.
    +5/-1     
    updatePatient.ts
    Refactor updatePatient logic and add resend email feature

    extensions/healthie/actions/updatePatient/updatePatient.ts

  • Refactored to use validatePayloadAndCreateSdk.
  • Added handling for resend_welcome_email.
  • Simplified error handling.
  • +51/-76 
    Tests
    createPatient.test.ts
    Fix typos in test descriptions for createPatient                 

    extensions/healthie/actions/createPatient/createPatient.test.ts

    • Corrected typo in test descriptions.
    +2/-2     
    updatePatient.test.ts
    Refactor and enhance tests for updatePatient                         

    extensions/healthie/actions/updatePatient/updatePatient.test.ts

  • Refactored tests to use new SDK and validation schema.
  • Added tests for field validation success and failure.
  • +130/-40

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling
    Ensure that all potential exceptions, especially those related to Zod validation, are handled appropriately to provide clear error messages to the end user.

    Field Configuration
    Review the necessity and implications of making many fields optional in the patient update action, which could lead to incomplete data handling.

    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @sharlotta93 sharlotta93 merged commit f7961de into main Nov 20, 2024
    1 check passed
    @sharlotta93 sharlotta93 deleted the refactor-update-patient branch November 20, 2024 11:49
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants