A MuleSoft IDP prompt that pulls device, therapy, and dosing details off a Statement of Medical Necessity (SMN) form into a structured 10-field JSON record, for automating device/CGM patient intake.
IDP Prompt — Statement of Medical Necessity Extraction
Objective: Device manufacturers (e.g. insulin pump / CGM vendors) receive a Statement of Medical Necessity (SMN) form as part of every referral packet. Re-keying its device, dosing, and date fields by hand slows down lead creation. This prompt extracts the SMN's key fields into a structured record in one pass.
Prerequisites
- MuleSoft IDP (Einstein) enabled; a
GENERIC document action created in Anypoint IDP, scoped to the SMN page range (pair with a page-classification prompt if the SMN arrives inside a larger packet).
- IDP Connector wired into the calling Mule app.
- Document-action prompt configured with
source: "llm".
The prompt
Extract Statement of Medical Necessity form details from the document.
IMPORTANT: You MUST respond with ONLY a valid JSON object. No markdown, no explanation, no code fences. Use null for any field not found in the document.
Output format (JSON object):
{"Device Ordered": "string|null (e.g. iLet Insulin Pump)", "CGM Type": "string|null (e.g. Freestyle Libre 3 Plus, Dexcom G6, Dexcom G7)", "Order Start Date": "string|null (MM/DD/YYYY)", "Length of Need": "string|null (e.g. Lifetime, 1 year)", "Diagnosis Date": "string|null (MM/DD/YYYY)", "Most Recent Weight": "string|null (in lbs)", "Therapy Type": "string|null (e.g. Multiple Daily Injections, Insulin Pump)", "Pump Supplies Frequency": "string|null (e.g. Every 2 days, Every 3 days)", "Glucose Fluctuation Range": "string|null (e.g. 40-440 mg/dL, the blood glucose range from low to high)", "Signature Date": "string|null (MM/DD/YYYY - date the prescriber signed the SMN form)"}
Sample payload — extraction output
{
"Device Ordered": "iLet Insulin Pump",
"CGM Type": "Dexcom G7",
"Order Start Date": "03/10/2026",
"Length of Need": "Lifetime",
"Diagnosis Date": "01/15/2019",
"Most Recent Weight": "162",
"Therapy Type": "Insulin Pump",
"Pump Supplies Frequency": "Every 3 days",
"Glucose Fluctuation Range": "60-320 mg/dL",
"Signature Date": "03/12/2026"
}
Testing and validation
- Happy path: a fully completed SMN form returns all 10 fields populated with correctly formatted dates.
- Edge case: a partially completed form (e.g. no stated "Length of Need") returns
null for that field rather than hallucinating a value — verify no field is ever silently omitted from the JSON object.
- Because
source: "llm" values arrive as JSON-encoded strings, unwrap each field with the standard conditional read() pattern before writing to the target system, so quotes don't leak through as literal \".
Deliverable: A structured SMN record ready to map into a Salesforce Lead/Case or downstream fulfillment system without manual re-keying.