Skip to main content

Soap

The Soap struct represents a detailed consultation summary, which includes subjective, objective, assessment, and plan components. This data is typically generated from a machine learning model based on consultation analysis.

Fields

  • summary: (Summary?) - Contains the entire SOAP note, including the following:
    • subjective: (Subjective?) - Patient-reported symptoms and concerns.
    • objective: (Objective?) - Clinician-observed physical findings and lab results.
    • assessment: (Assessment?) - Diagnosis and differential diagnoses.
    • plan: (Plan?) - Treatment plan, medications, and follow-up instructions.

Example Usage

Once the SOAP summary is returned from the model, you can access the different components (subjective, objective, assessment, plan) and process them for display, storage, or further analysis.

Example of Handling SOAP Summary Returned from the Model

In this example, the SOAP summary is returned from the model, and each part of the summary (subjective, objective, assessment, and plan) is accessed and printed only if data is available.

// Function to handle a SOAP summary returned from the model
func handleSoapSummary(soapSummary: Soap) {
if let summary = soapSummary.summary {
// Access the subjective section
if let subjective = summary.subjective {
if let symptoms = subjective.symptoms {
print("Subjective Symptoms: \(symptoms)")
}
if let concerns = subjective.concerns {
print("Concerns: \(concerns)")
}
}

// Access the objective section
if let objective = summary.objective {
if let labResults = objective.laboratoryResults {
print("Lab Results: \(labResults)")
}
if let physicalFindings = objective.physicalExaminationFindings {
print("Physical Findings: \(physicalFindings)")
}
}

// Access the assessment section
if let assessment = summary.assessment {
if let diagnosis = assessment.diagnosis {
print("Diagnosis: \(diagnosis)")
}
if let differentialDiagnosis = assessment.differentialDiagnosis {
print("Differential Diagnosis: \(differentialDiagnosis)")
}
}

// Access the plan section
if let plan = summary.plan {
if let medications = plan.medications {
print("Medications: \(medications)")
}
if let followUpInstructions = plan.followUpInstructions {
print("Follow-Up Instructions: \(followUpInstructions)")
}
}
} else {
print("SOAP summary is unavailable.")
}
}

// Example SOAP summary returned from the model
let soapSummaryFromModel = Soap(
summary: Soap.Summary(
subjective: Soap.Summary.Subjective(
symptoms: "Cough, Fever",
concerns: "Shortness of breath"
),
objective: Soap.Summary.Objective(
laboratoryResults: "Blood test normal",
physicalExaminationFindings: "Clear lungs"
),
assessment: Soap.Summary.Assessment(
diagnosis: "Viral infection",
differentialDiagnosis: "Bacterial infection"
),
plan: Soap.Summary.Plan(
nonPharmacologicalIntervention: "Rest and fluids",
medications: "Paracetamol",
followUpInstructions: "Return if symptoms worsen"
)
)
)

// Handle the SOAP summary
handleSoapSummary(soapSummary: soapSummaryFromModel)