Skip to content
The Chat Archive
gemini-2.5-flash· Google LMArena Human Preference 140K

i need to create soap note app like condition app .

  1. User

    i need to create soap note app like condition app .

  2. Assistant

    That's a fantastic goal! Creating a "SOAP Note app" similar to the "Condition List app" in OpenMRS involves a custom module that integrates with the OpenMRS Reference Application's patient dashboard.

    Let's break down what "like the Condition app" means and how to achieve it for SOAP notes.

    What "Like Condition App" Implies:

    1. Patient Dashboard Widget: A summary section on the patient's dashboard displaying recent SOAP notes (e.g., the last 3-5 notes, or a count).
    2. Dedicated "Manage" Page: A link from the widget (or a separate menu item) that takes you to a full page listing all SOAP notes for the patient chronologically, with options to:
      • Add New: A button to create a new SOAP note.
      • View/Edit Existing: Click on an entry to view the full note, and potentially allow editing (though editing encounters/observations in OpenMRS has specific implications we'll discuss).
    3. Structured Data Entry: Using an HTML Form Entry form to capture the S, O, A, P sections and store them as observations (Obs) within an encounter.
    4. Integration: Seamlessly working within the OpenMRS Reference Application UI.

    Core OpenMRS Concepts You'll Use:

    • EncounterType: You'll need a specific EncounterType (e.g., "SOAP Note Encounter") to categorize these visits.
    • Concepts: You'll need concepts for "Subjective," "Objective," "Assessment," and "Plan." These will typically be Text concepts, but "Assessment" could also be Coded if you want to select from a list of diagnoses.
    • HTML Form Entry Module: This is crucial for defining the structure of your SOAP note form and handling the UI for data entry and display.
    • OpenMRS Module (Omod): You'll build a custom OpenMRS module to provide the UI (widget and dedicated page) and integrate with the underlying OpenMRS services.
    • OpenMRS REST API: Your frontend (AngularJS/React/Vue in your Omod) will interact with OpenMRS via its REST API (or potentially custom REST endpoints you expose).

    Technical Approach (Recommended):

    You'll create an OpenMRS module (an omod file) that contains:

    1. Backend Components (Java):
      • A service layer (optional, but good for complex logic).
      • Controllers for any custom REST endpoints if needed (though existing encounter and obs endpoints are often sufficient).
      • Privileges and Global Properties definitions.
    2. Frontend Components (AngularJS or React/Vue):
      • Dashboard Widget: An AngularJS fragment (if using the Reference Application's existing framework) that pulls recent SOAP notes.
      • Main Page: A dedicated page with a table of all SOAP notes and a form for adding/editing. This could also be AngularJS, React, or Vue, depending on your familiarity and future plans for modernizing the UI. (For "like Condition App," AngularJS is often the path of least resistance due to existing Reference Application integration points).

    Step-by-Step Module Development Plan:

    Phase 1: Foundation (Concepts & Forms)

    1. Define Concepts:

      • Go to Administration > Dictionary > Manage Concepts.
      • Create concepts:
        • SOAP Note Subjective (Datatype: Text)
        • SOAP Note Objective (Datatype: Text)
        • SOAP Note Assessment (Datatype: Text or Coded)
        • SOAP Note Plan (Datatype: Text)
      • (Optional but Recommended): A SOAP Note parent concept (Datatype: N/A, Class: ConvSet or Misc) to group these children, especially useful for HTML Form Entry forms using obsGroup.
    2. Define Encounter Type:

      • Go to Administration > Encounters > Manage Encounter Types.
      • Create a new Encounter Type: SOAP Note Encounter (or similar).
    3. Create HTML Form Entry Form:

      • Go to Administration > HTML Form Entry > Manage Forms.
      • Click "Add New Form".
      • Give it a name (e.g., "SOAP Note Form") and select your SOAP Note Encounter type.
      • Design the form using HTML Form Entry tags. This is where you link the UI fields to your concepts:
      <htmlform formUuid="your-form-uuid-here" formName="SOAP Note Form" formVersion="1.0">
          <section title="SOAP Note">
              <fieldset>
                  <legend>Subjective</legend>
                  <textarea conceptId="SOAP Note Subjective" rows="5" cols="80" />
              </fieldset>
      
              <fieldset>
                  <legend>Objective</legend>
                  <textarea conceptId="SOAP Note Objective" rows="5" cols="80" />
              </fieldset>
      
              <fieldset>
                  <legend>Assessment</legend>
                  <textarea conceptId="SOAP Note Assessment" rows="5" cols="80" />
                  <!-- OR: <obs conceptId="SOAP Note Assessment" answerConceptIds="UUID_FOR_DIAGNOSIS1,UUID_FOR_DIAGNOSIS2" answerLabels="Diagnosis 1,Diagnosis 2"/> -->
              </fieldset>
      
              <fieldset>
                  <legend>Plan</legend>
                  <textarea conceptId="SOAP Note Plan" rows="5" cols="80" />
              </fieldset>
          </section>
          <submit/>
      </htmlform>
      
      • Save and test this form by creating a new SOAP Note Encounter for a patient through the "Start Visit" or "Add Past Visit" workflow.

    Phase 2: Module Development (The "App" UI)

    1. Set up OpenMRS Module Development Environment:

      • Follow the OpenMRS SDK instructions to create a new module project (e.g., mvn openmrs-sdk:create-project).
    2. Module Structure:

      • omod/src/main/java/org/openmrs/module/yourmodule: Your Java code.
      • omod/src/main/resources/config.xml: Module configuration (privileges, global properties).
      • omod/src/main/webapp/fragments: GSP files for dashboard fragments.
      • omod/src/main/webapp/pages: GSP files for your main app page.
      • omod/src/main/webapp/resources: AngularJS/JavaScript, CSS, HTML templates.
    3. Implement Dashboard Widget (AngularJS Fragment):

      • Create a GSP file (e.g., soapNoteWidget.gsp) in omod/src/main/webapp/fragments.
      • This GSP will include an AngularJS controller and a div to render the widget content.
      • config.xml Entry: Add an extension to include your widget on the patient dashboard.
      <extension>
          <id>org.openmrs.referenceapp.patientdashboard.OverviewFragmentExtension</id>
          <point>org.openmrs.referenceapp.patientdashboard.OverviewFragmentExtension</point>
          <order>10</order> <!-- Adjust order as needed -->
          <requiredPrivilege>App: coreapps.viewPatientDashboard</requiredPrivilege>
          <page>
              org.openmrs.module.yourmodule.fragment.controller.SoapNoteWidgetController
          </page>
      </extension>
      
      • AngularJS Controller: This controller will:
        • Fetch recent SOAP Note Encounters for the current patient using the OpenMRS REST API (/openmrs/ws/rest/v1/encounter).
        • Parse the encounters to extract the S, O, A, P observations.
        • Display a summary (e.g., date, a snippet of the subjective note).
        • Provide a link to your main "Manage SOAP Notes" page.
    4. Implement Main "Manage SOAP Notes" Page:

      • Create a Spring MVC Controller (e.g., SoapNoteAppController.java) in your Java package.
      • Create a GSP file (e.g., soapNotes.gsp) in omod/src/main/webapp/pages.
      • This page will list all SOAP notes in a table, showing date, and maybe a small summary. Each row should have a "View/Edit" link.
      • Add New Button: A button that either:
        • Redirects to the standard htmlformentry/htmlForm.page with your SOAP note form pre-selected (easiest).
        • Or, opens a modal with the form using AngularJS.
      • View/Edit Logic: When a user clicks to view/edit, you'll render the HTML Form Entry form again, populated with the existing data.
        • Important Note on Editing: OpenMRS Obs are generally immutable. When "editing" an existing encounter, OpenMRS often creates a new encounter that voids the old one or simply creates new observations that supersede old ones. Be clear about this to users. For SOAP notes, it's often better to add a new note or have a "Correction" encounter. The Condition app modifies a state (active/inactive/end date), which is different from modifying an historical record like a note.
    5. REST API Interaction:

      • Your AngularJS (or other frontend framework) code will use HttpClient (or jQuery.ajax) to call the OpenMRS REST API:
        • GET /openmrs/ws/rest/v1/encounter?patient=UUID&encounterType=SOAP_NOTE_ENCOUNTER_UUID&v=full to fetch all SOAP notes.
        • GET /openmrs/ws/rest/v1/form?uuid=YOUR_FORM_UUID to get form details.
        • POST /openmrs/ws/rest/v1/encounter to save new notes (when submitting the HTML Form Entry).

    Phase 3: Building and Deployment

    1. Build the Module:
      • From your module's root directory: mvn clean install
      • This will create a .omod file in omod/target.
    2. Deploy:
      • Copy the .omod file to your OpenMRS server's modules folder.
      • Restart OpenMRS or go to Administration > Manage Modules and start your new module.
    3. Configure:
      • Ensure your Concepts and Encounter Types are available on the server.
      • Make sure your HTML Form Entry form is published.

    Key Considerations and Challenges:

    • HTML Form Entry id vs. uuid: Be careful using concept IDs vs. UUIDs in your HTML Form Entry tags. UUIDs are generally preferred for stability across environments.
    • Permissions: Define specific privileges (e.g., Add SOAP Note, View SOAP Notes, Edit SOAP Notes) and assign them to appropriate roles.
    • Internationalization (i18n): If you need to support multiple languages, ensure your module's labels and messages are externalized and translated.
    • Error Handling and User Feedback: Implement proper error handling and provide clear messages to the user.
    • Styling: Ensure your app's UI is consistent with the OpenMRS Reference Application's look and feel.
    • Testing: Thoroughly test your module, both the backend logic and the frontend UI, to ensure data is saved and displayed correctly.
    • Version Compatibility: Ensure your module is compatible with the OpenMRS Core version and Reference Application version you are using.

    This is a significant project but entirely doable within the OpenMRS ecosystem. Start small, get the basic concepts and HTML form working, then build out the dashboard widget and the main app page step by step.

    Which part would you like to dive into first? Setting up the module, defining the HTML Form, or building the AngularJS components?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.