For AI agents: the documentation index is at /docs/aidbox/llms.txt. A Markdown version of this page is available at /docs/aidbox/notebooks.md or by requesting it with the Accept: text/markdown header.
Aidbox Docs
All notebooks

CCDA Converter API Demo

Description

2 cells · updated May 5, 2023

This is a read-only view. Responses shown were saved when the notebook was published — open it in your own Aidbox to run the cells against live data.
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
POST / 
content-type: text/yaml

resourceType: Bundle
type: transaction
entry:
  - resource:
      resourceType: Patient
      id: '42'
      name:
        - given:
            - Patient zero
          family: Smith
    request:
      method: PUT
      url: /Patient
  - resource:
      resourceType: Practitioner
      id: '42'
      extension:
        - url: foo
          value:
            string: bar
      name:
        - given:
            - Pract
          family: Smith
    request:
      method: PUT
      url: /Practitioner
  - resource:
      resourceType: Organization
      id: '42'
      name: Custodian org
    request:
      method: PUT
      url: /Organization
  - resource:
      value:
        Quantity:
          value: 27
          unit: mmol/L
      resourceType: Observation
      extension:
        - value:
            dateTime: '2015-06-22T22:00:00Z'
          url: authoring-time
      status: final
      effective:
        dateTime: '2012-08-15T10:05:00-08:00'
      id: co2-obs
      code:
        coding:
          - code: 2028-9
            display: Carbon dioxide
            system: http://loinc.org
      subject:
        id: '42'
        resourceType: Patient
      performer:
        - resourceType: Practitioner
          id: '42'
    request:
      method: PUT
      url: /Observation
  - resource:
      category:
        - coding:
            - system: http://terminology.hl7.org/CodeSystem/condition-category
              code: social-history
              display: Social History
      value:
        CodeableConcept:
          coding:
            - code: '160604004'
              display: Moderate cigarette smoker 10-19/day
              system: http://snomed.info/sct
      resourceType: Observation
      extension:
        - value:
            dateTime: '2015-06-22T22:00:00Z'
          url: authoring-time
      status: final
      effective:
        Period:
          start: '1992'
      code:
        coding:
          - code: 11367-0
            display: History of tobacco use
            system: http://loinc.org
      subject:
        id: '42'
        resourceType: Patient
      performer:
        - resourceType: Practitioner
          id: '42'
    request:
      method: PUT
      url: /Observation
  - resource:
      hasMember:
        - id: co2-obs
          resourceType: Observation
      performer:
        - resourceType: Practitioner
          id: '42'
      code:
        coding:
          - code: 2028-9
            display: Carbon dioxide
            system: http://loinc.org
      status: final
      resourceType: Observation
      extension:
        - value:
            dateTime: '2015-06-22T22:00:00Z'
          url: authoring-time
      category:
        - coding:
            - code: laboratory
              display: Laboratory
              system: http://terminology.hl7.org/CodeSystem/observation-category
      subject:
        id: '42'
        resourceType: Patient
    request:
      method: PUT
      url: /Observation
  - resource:
      subject:
        id: '42'
        resourceType: Patient
      onset:
        dateTime: '2014-03-02T12:45:36-05:00'
      category:
        - coding:
            - system: http://terminology.hl7.org/CodeSystem/condition-category
              code: problem-list-item
              display: Problem List Item
      clinicalStatus:
        coding:
          - code: active
            system: http://terminology.hl7.org/CodeSystem/condition-clinical
      resourceType: Condition
      recordedDate: '2020-02-02'
      recorder:
        resourceType: Practitioner
        id: '42'
      code:
        coding:
          - code: '385093006'
            display: Community Acquired Pneumonia
            system: http://snomed.info/sct
    request:
      method: PUT
      url: /Condition
  - resource:
      category:
        - coding:
            - code: vital-signs
              display: Vital Signs
              system: http://terminology.hl7.org/CodeSystem/observation-category
      value:
        Quantity:
          value: 177
          unit: cm
      resourceType: Observation
      extension:
        - value:
            dateTime: '2015-06-22T22:00:00Z'
          url: authoring-time
      status: final
      effective:
        dateTime: '2015-06-22'
      code:
        coding:
          - code: 8302-2
            display: Height
            system: http://loinc.org
      subject:
        id: '42'
        resourceType: Patient
      performer:
        - resourceType: Practitioner
          id: '42'
    request:
      method: PUT
      url: /Observation
  - resource:
      patient:
        id: '42'
        resourceType: Patient
      onset:
        Period:
          start: '2010-03-15'
      clinicalStatus:
        coding:
          - code: active
            system: http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical
      type: allergy
      resourceType: AllergyIntolerance
      extension:
        - value:
            dateTime: '2015-06-22T22:00:00Z'
          url: authoring-time
      recordedDate: '2014-01-03'
      id: 4a2ac5fc-0c85-4223-baee-c2e254803974
      recorder:
        resourceType: Practitioner
        id: '42'
      code:
        coding:
          - code: '2670'
            display: Codeine
            system: http://www.nlm.nih.gov/research/umls/rxnorm
      verificationStatus:
        coding:
          - code: confirmed
            system: >-
              http://terminology.hl7.org/CodeSystem/allergyintolerance-verification
      reaction:
        - manifestation:
            - coding:
                - code: '422587007'
                  display: Nausea
                  system: http://snomed.info/sct
          severity: severe
          onset: '2012-01-29'
        - manifestation:
            - coding:
                - code: '422587007'
                  display: Nausea
                  system: http://snomed.info/sct
          severity: mild
          onset: '2010-03-15'
    request:
      url: /AllergyIntolerance
      method: PUT
Response: Body
Status: 200
type: transaction-response
resourceType: Bundle
entry:
- resource:
    name:
    - given: [Patient zero]
      family: Smith
    id: '42'
    resourceType: Patient
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '114'}
  response: {etag: '114', location: /Patient/42/_history/114, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    name:
    - given: [Pract]
      family: Smith
    extension:
    - url: foo
      value: {string: bar}
    id: '42'
    resourceType: Practitioner
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '115'}
  response: {etag: '115', location: /Practitioner/42/_history/115, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    name: Custodian org
    id: '42'
    resourceType: Organization
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '116'}
  response: {etag: '116', location: /Organization/42/_history/116, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '117'}
    value:
      Quantity: {unit: mmol/L, value: 27}
    resourceType: Observation
    extension:
    - url: authoring-time
      value: {dateTime: '2015-06-22T22:00:00Z'}
    status: final
    effective: {dateTime: '2012-08-15T10:05:00-08:00'}
    id: co2-obs
    code:
      coding:
      - {code: 2028-9, system: 'http://loinc.org', display: Carbon dioxide}
    subject: {id: '42', resourceType: Patient}
    performer:
    - {id: '42', resourceType: Practitioner}
  response: {etag: '117', location: /Observation/co2-obs/_history/117, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    category:
    - coding:
      - {code: social-history, system: 'http://terminology.hl7.org/CodeSystem/condition-category', display: Social History}
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '118'}
    value:
      CodeableConcept:
        coding:
        - {code: '160604004', system: 'http://snomed.info/sct', display: Moderate cigarette smoker 10-19/day}
    resourceType: Observation
    extension:
    - url: authoring-time
      value: {dateTime: '2015-06-22T22:00:00Z'}
    status: final
    effective:
      Period: {start: '1992'}
    id: 1420f4ac-35cb-4f03-9b63-673ee94d9c8b
    code:
      coding:
      - {code: 11367-0, system: 'http://loinc.org', display: History of tobacco use}
    subject: {id: '42', resourceType: Patient}
    performer:
    - {id: '42', resourceType: Practitioner}
  response: {etag: '118', location: /Observation/1420f4ac-35cb-4f03-9b63-673ee94d9c8b/_history/118, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    category:
    - coding:
      - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
    hasMember:
    - {id: co2-obs, resourceType: Observation}
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '119'}
    resourceType: Observation
    extension:
    - url: authoring-time
      value: {dateTime: '2015-06-22T22:00:00Z'}
    status: final
    id: 14536e6c-23ce-42b5-b79b-4a3c9c459373
    code:
      coding:
      - {code: 2028-9, system: 'http://loinc.org', display: Carbon dioxide}
    subject: {id: '42', resourceType: Patient}
    performer:
    - {id: '42', resourceType: Practitioner}
  response: {etag: '119', location: /Observation/14536e6c-23ce-42b5-b79b-4a3c9c459373/_history/119, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    onset: {dateTime: '2014-03-02T12:45:36-05:00'}
    category:
    - coding:
      - {code: problem-list-item, system: 'http://terminology.hl7.org/CodeSystem/condition-category', display: Problem List Item}
    clinicalStatus:
      coding:
      - {code: active, system: 'http://terminology.hl7.org/CodeSystem/condition-clinical'}
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '120'}
    resourceType: Condition
    recordedDate: '2020-02-02'
    id: e119138b-f677-46b6-9e25-f9df714376b3
    recorder: {id: '42', resourceType: Practitioner}
    code:
      coding:
      - {code: '385093006', system: 'http://snomed.info/sct', display: Community Acquired Pneumonia}
    subject: {id: '42', resourceType: Patient}
  response: {etag: '120', location: /Condition/e119138b-f677-46b6-9e25-f9df714376b3/_history/120, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    category:
    - coding:
      - {code: vital-signs, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Vital Signs}
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '121'}
    value:
      Quantity: {unit: cm, value: 177}
    resourceType: Observation
    extension:
    - url: authoring-time
      value: {dateTime: '2015-06-22T22:00:00Z'}
    status: final
    effective: {dateTime: '2015-06-22'}
    id: 8889c659-bd91-4016-a27b-f7c5c79d1545
    code:
      coding:
      - {code: 8302-2, system: 'http://loinc.org', display: Height}
    subject: {id: '42', resourceType: Patient}
    performer:
    - {id: '42', resourceType: Practitioner}
  response: {etag: '121', location: /Observation/8889c659-bd91-4016-a27b-f7c5c79d1545/_history/121, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
- resource:
    patient: {id: '42', resourceType: Patient}
    onset:
      Period: {start: '2010-03-15'}
    clinicalStatus:
      coding:
      - {code: active, system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical'}
    meta: {lastUpdated: '2023-05-05T15:06:17.461530Z', createdAt: '2023-05-05T15:06:17.461530Z', versionId: '122'}
    type: allergy
    resourceType: AllergyIntolerance
    extension:
    - url: authoring-time
      value: {dateTime: '2015-06-22T22:00:00Z'}
    recordedDate: '2014-01-03'
    id: 4a2ac5fc-0c85-4223-baee-c2e254803974
    recorder: {id: '42', resourceType: Practitioner}
    code:
      coding:
      - {code: '2670', system: 'http://www.nlm.nih.gov/research/umls/rxnorm', display: Codeine}
    verificationStatus:
      coding:
      - {code: confirmed, system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification'}
    reaction:
    - onset: '2012-01-29'
      severity: severe
      manifestation:
      - coding:
        - {code: '422587007', system: 'http://snomed.info/sct', display: Nausea}
    - onset: '2010-03-15'
      severity: mild
      manifestation:
      - coding:
        - {code: '422587007', system: 'http://snomed.info/sct', display: Nausea}
  response: {etag: '122', location: /AllergyIntolerance/4a2ac5fc-0c85-4223-baee-c2e254803974/_history/122, status: '201', lastModified: '2023-05-05T15:06:17.461530Z'}
id: '123'
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
POST /ccda/prepare-doc?pid=42 
Content-Type: application/json

{"type": {
    "code": "18842-5",
    "display": "Discharge Summary",
    "system": "http://loinc.org"
  },
  "date": "2020-02-02",
  "title": "Discharge summary example",
  "subject": {
    "method": "GET",
    "url": "/Patient/{{pid	}}"
  },
  "custodian": {
    "method": "GET",
    "url": "/Organization/42"
  },
  "author": {
    "method": "GET",
    "url": "/Practitioner/42"
  },
  "section": [
    {
      "title": "Allergies and Intolerances",
      "code": {
        "code": "48765-2",
        "display": "Allergies",
        "system": "http://loinc.org"
      },
      "template": "Allergies",
      "entry": {
        "method": "GET",
        "url": "/AllergyIntolerance?patient=Patient/{{pid}}"
      }
    },
    {
      "title": "Results",
      "code": {
        "code": "30954-2",
        "display": "Results",
        "system": "http://loinc.org"
      },
      "template": "Results html",
      "entry": {
        "method": "GET",
        "url": "/Observation?subject=Patient/{{pid}}&category=laboratory&_assoc=hasMember"
      }
    },
    {
      "title": "Social History",
      "code": {
        "code": "29762-2",
        "display": "Social History",
        "system": "http://loinc.org"
      },
      "template": "Social History",
      "entry": {
        "method": "GET",
        "url": "/Observation?subject=Patient/{{pid}}&category=social-history&_assoc=hasMember"
      }
    },
    {
      "title": "Problems",
      "code": {
        "code": "11450-4",
        "display": "Problems",
        "system": "http://loinc.org"
      },
      "template": "Problems",
      "entry": {
        "method": "GET",
        "url": "/Condition?subject=Patient/{{pid}}&category=problem-list-item"
      }
    },
    {
      "title": "Vital Signs",
      "code": {
        "code": "8716-3",
        "display": "Vitals",
        "system": "http://loinc.org"
      },
      "template": "Vitals",
      "entry": {
        "method": "GET",
        "url": "/Observation?category=vital-signs&subject=Patient/{{pid}}"
      }
    }
  ]
}
Response: Body
Status: 200
{
  "resourceType": "Bundle",
  "type": "document",
  "id": "processing",
  "original-bundle": {
    "resourceType": "OperationOutcome",
    "id": "processing",
    "text": {
      "status": "generated",
      "div": "Transaction failed at entry[2]. Response status is 404. Response body is {\"resourceType\":\"OperationOutcome\",\"id\":\"not-found\",\"text\":{\"status\":\"generated\",\"div\":\"Resource Patient/42  not found\"},\"issue\":[{\"severity\":\"fatal\",\"code\":\"not-found\",\"diagnostics\":\"Resource Patient/42  not found\"}]}."
    },
    "issue": [
      {
        "severity": "fatal",
        "code": "not-found",
        "diagnostics": "Resource Patient/42  not found"
      }
    ]
  },
  "entry": [
    {
      "resource": {
        "date": "2020-02-02",
        "section": [
          {
            "title": "Allergies and Intolerances",
            "code": {
              "coding": [
                {
                  "code": "48765-2",
                  "display": "Allergies",
                  "system": "http://loinc.org"
                }
              ]
            },
            "text": {
              "div": "Allergies",
              "status": "generated"
            },
            "entry": []
          },
          {
            "title": "Results",
            "code": {
              "coding": [
                {
                  "code": "30954-2",
                  "display": "Results",
                  "system": "http://loinc.org"
                }
              ]
            },
            "text": {
              "div": "Results html",
              "status": "generated"
            },
            "entry": []
          },
          {
            "title": "Social History",
            "code": {
              "coding": [
                {
                  "code": "29762-2",
                  "display": "Social History",
                  "system": "http://loinc.org"
                }
              ]
            },
            "text": {
              "div": "Social History",
              "status": "generated"
            },
            "entry": []
          },
          {
            "title": "Problems",
            "code": {
              "coding": [
                {
                  "code": "11450-4",
                  "display": "Problems",
                  "system": "http://loinc.org"
                }
              ]
            },
            "text": {
              "div": "Problems",
              "status": "generated"
            },
            "entry": []
          },
          {
            "title": "Vital Signs",
            "code": {
              "coding": [
                {
                  "code": "8716-3",
                  "display": "Vitals",
                  "system": "http://loinc.org"
                }
              ]
            },
            "text": {
              "div": "Vitals",
              "status": "generated"
            },
            "entry": []
          }
        ],
        "type": {
          "coding": [
            {
              "code": "18842-5",
              "display": "Discharge Summary",
              "system": "http://loinc.org"
            }
          ]
        },
        "resourceType": "Composition",
        "title": "Discharge summary example",
        "author": [
          {}
        ],
        "extension": [
          {
            "url": "authoring-time",
            "value": {
              "dateTime": "2020-02-02"
            }
          }
        ],
        "custodian": {},
        "status": "final",
        "id": "composition",
        "subject": {}
      }
    }
  ]
}