Process Medical Records

Extract patient details, diagnoses, and medications from medical records into structured JSON for healthcare workflows.

Who this is for

Healthcare providers and clinical software platforms use this recipe to digitize patient records. Upload a medical document and receive structured JSON with patient details, diagnosis codes, and medication lists — ready for integration with your EHR or clinical database.

curl -X POST https://api.iterationlayer.com/document-extraction/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "type": "url",
        "name": "medical-record.pdf",
        "url": "https://example.com/records/medical-record.pdf"
      }
    ],
    "schema": {
      "fields": [
        { "name": "patient_name", "type": "TEXT", "description": "Full name of the patient" },
        { "name": "date_of_birth", "type": "DATE", "description": "Patient date of birth" },
        { "name": "diagnoses", "type": "ARRAY", "description": "List of diagnoses", "fields": [
          { "name": "code", "type": "TEXT", "description": "Diagnosis or ICD code" },
          { "name": "description", "type": "TEXT", "description": "Diagnosis description" }
        ]},
        { "name": "medications", "type": "ARRAY", "description": "List of prescribed medications", "fields": [
          { "name": "name", "type": "TEXT", "description": "Medication name" },
          { "name": "dosage", "type": "TEXT", "description": "Prescribed dosage" }
        ]}
      ]
    }
  }'
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extract({
  files: [
    {
      type: "url",
      name: "medical-record.pdf",
      url: "https://example.com/records/medical-record.pdf",
    },
  ],
  schema: {
    fields: [
      { name: "patient_name", type: "TEXT", description: "Full name of the patient" },
      { name: "date_of_birth", type: "DATE", description: "Patient date of birth" },
      { name: "diagnoses", type: "ARRAY", description: "List of diagnoses", fields: [
        { name: "code", type: "TEXT", description: "Diagnosis or ICD code" },
        { name: "description", type: "TEXT", description: "Diagnosis description" },
      ]},
      { name: "medications", type: "ARRAY", description: "List of prescribed medications", fields: [
        { name: "name", type: "TEXT", description: "Medication name" },
        { name: "dosage", type: "TEXT", description: "Prescribed dosage" },
      ]},
    ],
  },
});

console.log(result);
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract(
    files=[
        {
            "type": "url",
            "name": "medical-record.pdf",
            "url": "https://example.com/records/medical-record.pdf",
        }
    ],
    schema={
        "fields": [
            {"name": "patient_name", "type": "TEXT", "description": "Full name of the patient"},
            {"name": "date_of_birth", "type": "DATE", "description": "Patient date of birth"},
            {"name": "diagnoses", "type": "ARRAY", "description": "List of diagnoses", "fields": [
                {"name": "code", "type": "TEXT", "description": "Diagnosis or ICD code"},
                {"name": "description", "type": "TEXT", "description": "Diagnosis description"},
            ]},
            {"name": "medications", "type": "ARRAY", "description": "List of prescribed medications", "fields": [
                {"name": "name", "type": "TEXT", "description": "Medication name"},
                {"name": "dosage", "type": "TEXT", "description": "Prescribed dosage"},
            ]},
        ]
    },
)

print(result)
package main

import il "github.com/iterationlayer/sdk-go"

client := il.NewClient("YOUR_API_KEY")

result, err := client.Extract(il.ExtractRequest{
    Files: []il.FileInput{
        il.NewFileFromURL("medical-record.pdf", "https://example.com/records/medical-record.pdf"),
    },
    Schema: il.ExtractionSchema{
        "patient_name":  il.NewTextFieldConfig("patient_name", "Full name of the patient"),
        "date_of_birth": il.NewDateFieldConfig("date_of_birth", "Patient date of birth"),
        "diagnoses": il.NewArrayFieldConfig("diagnoses", "List of diagnoses", []il.FieldConfig{
            il.NewTextFieldConfig("code", "Diagnosis or ICD code"),
            il.NewTextFieldConfig("description", "Diagnosis description"),
        }),
        "medications": il.NewArrayFieldConfig("medications", "List of prescribed medications", []il.FieldConfig{
            il.NewTextFieldConfig("name", "Medication name"),
            il.NewTextFieldConfig("dosage", "Prescribed dosage"),
        }),
    },
})

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.