Creating a SOAP note app in OpenMRS (similar to the "Condition" app) involves a combination of backend module development and frontend UI work. Below is a step-by-step guide to help you design and implement a SOAP note management app in OpenMRS.
1. Understand the OpenMRS Architecture
- OpenMRS apps are typically built as modules (Java-based) or frontend modules (Angular/React).
- The Condition app (part of the Reference Application) manages patient conditions/diagnoses. Your SOAP note app would follow a similar pattern but focus on SOAP note data.
2. Define the Data Model
SOAP notes involve structured clinical data. You’ll need to map SOAP sections to OpenMRS concepts/observations:
SOAP Data Structure
- Subjective: Patient-reported symptoms, history.
- Objective: Vitals, lab results, physical exam findings.
- Assessment: Diagnoses, problems.
- Plan: Treatment, follow-up.
OpenMRS Data Mapping
- Use Concepts to represent SOAP fields (e.g.,
SOAP.Subjective, SOAP.Objective).
- Store SOAP notes as Observations linked to encounters.
Example Concept Setup:
- Create Concepts in OpenMRS Admin:
SOAP.Subjective (Text)
SOAP.Objective (Text)
SOAP.Assessment (Diagnosis/Concept)
SOAP.Plan (Text)
3. Create a Backend Module (Java)
If you need custom logic (e.g., validation, complex workflows), create a Java module.
Step 1: Set Up the Module
- Use the OpenMRS SDK to create a module:
mvn openmrs-sdk:init -DartifactId=soap-note-module -Dname="SOAP Note Module"
- Define the module in
pom.xml and module.properties.
Step 2: Define a SOAP Note Entity
Create a Java class to represent a SOAP note:
public class SoapNote {
private String patientUuid;
private String encounterUuid;
private String subjective;
private String objective;
private String assessment;
private String plan;
// Getters, setters, and persistence logic
}
Step 3: Create a REST API Endpoint
Add a REST controller to save/retrieve SOAP notes using the OpenMRS API:
@RestController
@RequestMapping("/soapNote")
public class SoapNoteController {
@Autowired
private ObservationService observationService;
@PostMapping
public ResponseEntity<String> saveSoapNote(@RequestBody SoapNote soapNote) {
// Save to OpenMRS observations/encounters
return ResponseEntity.ok("SOAP note saved!");
}
}
4. Build the Frontend (Angular)
Most OpenMRS frontend apps use Angular with the OpenMRS ESM Framework.
Step 1: Create an Angular Module
- Use the OpenMRS Angular Template to scaffold your app.
- Define a module
soap-note-app in src/app/soap-note/soap-note.module.ts.
Step 2: Create a Form Component
Build a form with sections for SOAP:
// soap-note-form.component.ts
import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-soap-note-form',
template: `
<form [formGroup]="soapForm" (ngSubmit)="onSubmit()">
<h2>Subjective</h2>
<textarea formControlName="subjective"></textarea>
<h2>Objective</h2>
<textarea formControlName="objective"></textarea>
<h2>Assessment</h2>
<input formControlName="assessment" />
<h2>Plan</h2>
<textarea formControlName="plan"></textarea>
<button type="submit">Save</button>
</form>
`,
})
export class SoapNoteFormComponent {
soapForm: FormGroup;
constructor(private fb: FormBuilder) {
this.soapForm = this.fb.group({
subjective: [''],
objective: [''],
assessment: [''],
plan: [''],
});
}
onSubmit() {
// Send data to backend via REST API
}
}
Step 3: Link to Patient Dashboard
Add the SOAP note form to the patient dashboard (like the Condition app):
// PatientDashboardComponent.ts
@Component({
template: `
<app-soap-note-form [patientUuid]="patientUuid"></app-soap-note-form>
`,
})
export class PatientDashboardComponent {
patientUuid = 'current-patient-uuid';
}
5. Integrate with OpenMRS APIs
Use the OpenMRS REST API to fetch/store data:
// soap-note.service.ts
@Injectable()
export class SoapNoteService {
constructor(private http: HttpClient) {}
saveSoapNote(patientUuid: string, soapData: SoapNote) {
return this.http.post(`/openmrs/ws/rest/v1/soapNote`, {
patient: patientUuid,
...soapData,
});
}
}
6. Test and Deploy
- Run the Module:
- Start OpenMRS with the module:
mvn openmrs-sdk:run
- Test the Frontend:
- Use
npm start to run the Angular app and debug in the browser.
Example Workflow
- User navigates to a patient’s dashboard.
- Clicks "Add SOAP Note" (similar to "Add Condition" in the Condition app).
- Fills out the SOAP form.
- Data is saved to OpenMRS via REST API.
Key Resources
- OpenMRS Module Development Guide
- OpenMRS ESM Documentation
- Condition App Codebase (for reference)
Would you like help with a specific part (e.g., backend logic, Angular form setup)? Let me know!