Skip to content

Conversation

@rahu1ramesh
Copy link
Contributor

@rahu1ramesh rahu1ramesh commented May 25, 2025

JIRA → BN-71

This PR introduces the ability to search, select, and manage diagnoses from the consultation pad as part of the patient’s clinical documentation. It lays the groundwork for diagnosis capture in the consultation workflow, in alignment with the FHIR Condition resource model. This implementation is also includes the diagnosis saving functionality.


Key Features

  • Enables diagnosis search using a terminology source (OpenMRS Dictionary / Snowstorm / CIEL).
  • Allows providers to add multiple diagnoses with associated certainty.
  • Supports removal of added diagnoses before final submission.
  • Displays relevant messages for duplicates or empty results.
  • Provides locale-based internationalisation for all visible labels.
  • Backend integration for saving diagnoses.
  • Storybook for all new components

Implementation Details

  • Diagnosis Search:

    • Integrated with the OpenMRS REST API via /ws/rest/v1/bahmni/terminologies/concepts.
    • Implements input debouncing to trigger search.
    • Displays a dropdown list of matching results with fallback messaging when no matches are found.
    • Prevents duplicate entries by validating selected diagnoses.
  • Certainty Selection:

    • Adds a dropdown for each selected diagnosis with options: Provisional and Confirmed.
  • Diagnosis Management:

    • Enables removal of individual diagnoses via a cross icon.
  • Internationalisation:

    • Fully integrated with the locale dictionary to support multilingual label rendering.

Testing & Type Definitions

  • Unit and basic integration tests are included for key components and logic paths.
  • TypeScript types are defined for diagnosis entries and verification status options.

Screenshots

Search Diagnoses Add Diagnosis Add Certainty Add Duplicate Diagnosis Missing Certainty Save Success
Screenshot 2025-05-28 at 6 18 10 AM Screenshot 2025-05-28 at 6 18 20 AM Screenshot 2025-05-28 at 6 18 26 AM Screenshot 2025-05-28 at 6 18 47 AM Screenshot 2025-05-28 at 6 19 04 AM Screenshot 2025-05-28 at 6 28 03 AM

@rahu1ramesh rahu1ramesh requested a review from mohan-13 May 25, 2025 09:19
Copy link
Member

@mohan-13 mohan-13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The item selection using keyboard is not working. When I do a down arrow on the filtered items and then hit Enter, always the first item is selected.

const [isSubmitting, setIsSubmitting] = React.useState(false);

// DiagnosesForm state management
const [searchDiagnosesTerm, setSearchDiagnosesTerm] = React.useState('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The searchTerm, diagnosesErrors doesn't need to be a concern / part of consultation pad. This can be controlled within DiagnosisForm. Only the selectedDiagnosis can be part of ConsultationPad, which will be consumed during Consultation Bundle creation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have addressed this. Thanks for taking a look

const { addNotification } = useNotification();

// Use concept search hook for diagnoses
const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this can be moved into DiagnosisForm. The parent (ConsultationPad) component is only interested in selectedDiagnosis, whatever happens before that can be the components action itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have addressed this. Thanks for taking a look

it('should render DiagnosesForm component after loading', async () => {
// Import concept service
// eslint-disable-next-line
const conceptService = require('@services/conceptService');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method of mocking seems to be inconsistent with how other services are mocked. Can we mock at beforeEach level ?

@mohan-13 mohan-13 merged commit c708838 into main May 28, 2025
2 checks passed
@mohan-13 mohan-13 deleted the BN-71 branch May 28, 2025 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants