> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Predict FHIR Resources

> Predict FHIR R4 resources from clinical text. This is a stateless tool: it reads the clinical note from the request `context`, extracts the clinical facts found in it, and returns them as FHIR R4 resources collected in a FHIR R4 transaction Bundle (https://hl7.org/fhir/R4/bundle.html). The Bundle can be POSTed as-is to the base URL of a FHIR R4 server, which creates every resource and resolves the references between them.

You do not need to know FHIR to use this endpoint. FHIR is the healthcare interoperability standard; each returned `Bundle.entry[].resource` is a structured object for one clinical fact, identified by its `resourceType`, for example `Condition` (https://hl7.org/fhir/R4/condition.html) or `AllergyIntolerance` (https://hl7.org/fhir/R4/allergyintolerance.html). See the response examples and the schema descriptions of `FhirBundleEntry` for the resource types produced today.

How to read the response:

- A `Patient` and an `Encounter` are always returned, first and second; they carry whatever the note and the request state about them. Every other resource is returned only for facts present in the note that satisfy the requested resource-group selection, category selection and code filters. A missing `resourceType` means no matching resources were returned, not necessarily that the note contained no facts of that type. A Bundle holding only Patient and Encounter is a successful response, not an error.
- The same type may appear more than once (for example, once per condition found). Identify resources by their `id`, not by entry position.
- Every entry has a `fullUrl` of the form `urn:uuid:<id>` (https://www.rfc-editor.org/rfc/rfc4122), and every reference inside the Bundle points at one of them: clinical resources point at the Patient (`subject` or `patient`), and Condition, Procedure and Observation also point at the Encounter (`encounter`).
- Every entry carries a transaction `request` (`POST` to its resource type). Patient and Encounter are conditional creates on their business identifier (`ifNoneExist`), so a FHIR server that already holds that patient or encounter links the new resources to it instead of creating a duplicate.
- FHIR R4 requires some elements even when the note does not state them (`Encounter.class`, `FamilyMemberHistory.relationship`, `AllergyIntolerance.reaction.manifestation`, `Procedure.performer.actor`). Such an element then carries only the FHIR data-absent-reason extension (`FhirDataAbsentReasonExtension`) instead of a guessed value. An unstated `Encounter.status` is `unknown`.
- Where the model grounds a resource field in the note, the resource carries an evidence extension (`…/mention`, see `FhirMentionExtension`) with the character offsets of the supporting text. Competing codes ride in alternative extensions (`…/alternative`, see `FhirAlternativeExtension`). Worked examples are attached to this endpoint.
- Offsets count characters in the request note. For a `contextType: other` context the note is the `data` string. For a `contextType: clinicalNote` context the note is the sections written one after another as `"<title>:\n<body>\n\n"`; spans inside one section also carry `sectionId`, `sectionStart` and `sectionEnd`, the position within that section's `title` followed by its `body`. `start` is inclusive, `end` is exclusive.
- New resource types may be added in the future. Ignore entries whose `resourceType` you do not recognize.

Known facts about the patient (`patient`) or the encounter (`encounter`) can be supplied in the request; every supplied field overrides the value the model extracts from the note.

The output can be narrowed in two independent ways. `resourceGroups` selects which resource types (and categories within them) are produced; Patient and Encounter are always produced. `filters` restricts which codes may be returned, per coding system and optionally per resource group, category and coded field.



## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /tools/fhir/
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: FHIR
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
  - name: Evaluations
paths:
  /tools/fhir/:
    post:
      tags:
        - FHIR
      summary: Predict FHIR Resources
      description: >-
        Predict FHIR R4 resources from clinical text. This is a stateless tool:
        it reads the clinical note from the request `context`, extracts the
        clinical facts found in it, and returns them as FHIR R4 resources
        collected in a FHIR R4 transaction Bundle
        (https://hl7.org/fhir/R4/bundle.html). The Bundle can be POSTed as-is to
        the base URL of a FHIR R4 server, which creates every resource and
        resolves the references between them.


        You do not need to know FHIR to use this endpoint. FHIR is the
        healthcare interoperability standard; each returned
        `Bundle.entry[].resource` is a structured object for one clinical fact,
        identified by its `resourceType`, for example `Condition`
        (https://hl7.org/fhir/R4/condition.html) or `AllergyIntolerance`
        (https://hl7.org/fhir/R4/allergyintolerance.html). See the response
        examples and the schema descriptions of `FhirBundleEntry` for the
        resource types produced today.


        How to read the response:


        - A `Patient` and an `Encounter` are always returned, first and second;
        they carry whatever the note and the request state about them. Every
        other resource is returned only for facts present in the note that
        satisfy the requested resource-group selection, category selection and
        code filters. A missing `resourceType` means no matching resources were
        returned, not necessarily that the note contained no facts of that type.
        A Bundle holding only Patient and Encounter is a successful response,
        not an error.

        - The same type may appear more than once (for example, once per
        condition found). Identify resources by their `id`, not by entry
        position.

        - Every entry has a `fullUrl` of the form `urn:uuid:<id>`
        (https://www.rfc-editor.org/rfc/rfc4122), and every reference inside the
        Bundle points at one of them: clinical resources point at the Patient
        (`subject` or `patient`), and Condition, Procedure and Observation also
        point at the Encounter (`encounter`).

        - Every entry carries a transaction `request` (`POST` to its resource
        type). Patient and Encounter are conditional creates on their business
        identifier (`ifNoneExist`), so a FHIR server that already holds that
        patient or encounter links the new resources to it instead of creating a
        duplicate.

        - FHIR R4 requires some elements even when the note does not state them
        (`Encounter.class`, `FamilyMemberHistory.relationship`,
        `AllergyIntolerance.reaction.manifestation`,
        `Procedure.performer.actor`). Such an element then carries only the FHIR
        data-absent-reason extension (`FhirDataAbsentReasonExtension`) instead
        of a guessed value. An unstated `Encounter.status` is `unknown`.

        - Where the model grounds a resource field in the note, the resource
        carries an evidence extension (`…/mention`, see `FhirMentionExtension`)
        with the character offsets of the supporting text. Competing codes ride
        in alternative extensions (`…/alternative`, see
        `FhirAlternativeExtension`). Worked examples are attached to this
        endpoint.

        - Offsets count characters in the request note. For a `contextType:
        other` context the note is the `data` string. For a `contextType:
        clinicalNote` context the note is the sections written one after another
        as `"<title>:\n<body>\n\n"`; spans inside one section also carry
        `sectionId`, `sectionStart` and `sectionEnd`, the position within that
        section's `title` followed by its `body`. `start` is inclusive, `end` is
        exclusive.

        - New resource types may be added in the future. Ignore entries whose
        `resourceType` you do not recognize.


        Known facts about the patient (`patient`) or the encounter (`encounter`)
        can be supplied in the request; every supplied field overrides the value
        the model extracts from the note.


        The output can be narrowed in two independent ways. `resourceGroups`
        selects which resource types (and categories within them) are produced;
        Patient and Encounter are always produced. `filters` restricts which
        codes may be returned, per coding system and optionally per resource
        group, category and coded field.
      operationId: fhir_predict
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
        - $ref: '#/components/parameters/X-Corti-Retention-Policy'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FhirPredictRequest'
            examples:
              basic:
                summary: Predict from a single text block
                value:
                  context:
                    contextType: other
                    data: >-
                      Maria Nielsen, born 25 December 1974, presents to the
                      emergency department with worsening breathlessness at
                      night. She has known asthma since childhood. Penicillin
                      gives her a rash. Her father also has asthma.
              with_patient_and_encounter:
                summary: Known patient and encounter; note sent as titled sections
                value:
                  context:
                    contextType: clinicalNote
                    data:
                      - id: plan
                        title: Plan
                        body: Patient to follow up in two weeks.
                      - id: vitals
                        title: Vitals
                        body: Systolic blood pressure is 150 mmHg.
                  patient:
                    identifier: MRN-00123
                  encounter:
                    status: finished
                    class: ambulatory
              with_selection_and_filters:
                summary: >-
                  Only vital signs and conditions, with conditions restricted to
                  respiratory disorders
                value:
                  context:
                    contextType: other
                    data: >-
                      Known asthma, now with a cough. Blood pressure 150/90
                      mmHg, pulse 88.
                  resourceGroups:
                    - type: Observation
                      categories:
                        - vital-signs
                    - type: Condition
                  filters:
                    - systemId: snomedctint
                      scope:
                        resourceGroup: Condition
                        field: code
                      include:
                        conditions:
                          - property: code
                            op: is-a
                            value:
                              - '50043002'
      responses:
        '200':
          description: >-
            The clinical facts found in the note, returned as FHIR R4 resources
            in a FHIR Bundle, together with the credits consumed by the request.
          headers:
            X-Corti-Retention-Policy:
              $ref: '#/components/headers/X-Corti-Retention-Policy'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FhirPredictResponse'
              examples:
                success:
                  summary: >-
                    Patient, encounter, condition, allergy and family history
                    found in the note
                  value:
                    bundle:
                      resourceType: Bundle
                      type: transaction
                      timestamp: '2025-01-15T09:30:47.512034+00:00'
                      entry:
                        - fullUrl: urn:uuid:a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                          resource:
                            resourceType: Patient
                            id: a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                            identifier:
                              - system: http://corti.app/fhir/identifier/patient
                                value: a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                            gender: female
                            birthDate: '1974-12-25'
                            name:
                              - text: Maria Nielsen
                          request:
                            method: POST
                            url: Patient
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/patient|a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                        - fullUrl: urn:uuid:b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                          resource:
                            resourceType: Encounter
                            id: b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                            identifier:
                              - system: http://corti.app/fhir/identifier/encounter
                                value: b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                            status: in-progress
                            class:
                              system: http://terminology.hl7.org/CodeSystem/v3-ActCode
                              code: EMER
                              display: emergency
                            subject:
                              reference: urn:uuid:a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                              type: Patient
                          request:
                            method: POST
                            url: Encounter
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/encounter|b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                        - fullUrl: urn:uuid:3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
                          resource:
                            resourceType: Condition
                            id: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
                            code:
                              coding:
                                - system: http://snomed.info/sct
                                  code: '195967001'
                                  display: Asthma
                              text: Asthma
                            clinicalStatus:
                              coding:
                                - system: >-
                                    http://terminology.hl7.org/CodeSystem/condition-clinical
                                  code: active
                                  display: Active
                              text: Active
                            verificationStatus:
                              coding:
                                - system: >-
                                    http://terminology.hl7.org/CodeSystem/condition-ver-status
                                  code: confirmed
                                  display: Confirmed
                              text: Confirmed
                            category:
                              - coding:
                                  - system: >-
                                      http://terminology.hl7.org/CodeSystem/condition-category
                                    code: problem-list-item
                                    display: Problem List Item
                                text: Problem List Item
                            subject:
                              reference: urn:uuid:a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                              type: Patient
                            encounter:
                              reference: urn:uuid:b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                              type: Encounter
                              identifier:
                                system: http://corti.app/fhir/identifier/encounter
                                value: b7c4e1d9-2a3f-5c8b-9d5e-6f0a1b2c3d7e
                            extension:
                              - url: >-
                                  https://docs.corti.ai/fhir/StructureDefinition/mention
                                extension:
                                  - url: field
                                    valueString: code
                                  - url: evidence
                                    extension:
                                      - url: start
                                        valueInteger: 129
                                      - url: end
                                        valueInteger: 135
                                      - url: text
                                        valueString: asthma
                              - url: >-
                                  https://docs.corti.ai/fhir/StructureDefinition/alternative
                                extension:
                                  - url: field
                                    valueString: code
                                  - url: alternative
                                    valueCodeableConcept:
                                      coding:
                                        - system: http://snomed.info/sct
                                          code: '233678006'
                                          display: Childhood asthma
                                      text: Childhood asthma
                          request:
                            method: POST
                            url: Condition
                        - fullUrl: urn:uuid:5e8f4d3c-0a6b-5c9f-8b2d-3a4f5e6d7c81
                          resource:
                            resourceType: AllergyIntolerance
                            id: 5e8f4d3c-0a6b-5c9f-8b2d-3a4f5e6d7c81
                            code:
                              coding:
                                - system: http://snomed.info/sct
                                  code: '91936005'
                                  display: Allergy to penicillin
                              text: Allergy to penicillin
                            type: allergy
                            category:
                              - medication
                            patient:
                              reference: urn:uuid:a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                              type: Patient
                            reaction:
                              - manifestation:
                                  - coding:
                                      - system: http://snomed.info/sct
                                        code: '271807003'
                                        display: Eruption of skin
                                    text: Eruption of skin
                                description: rash
                            extension:
                              - url: >-
                                  https://docs.corti.ai/fhir/StructureDefinition/mention
                                extension:
                                  - url: field
                                    valueString: code
                                  - url: evidence
                                    extension:
                                      - url: start
                                        valueInteger: 153
                                      - url: end
                                        valueInteger: 163
                                      - url: text
                                        valueString: Penicillin
                          request:
                            method: POST
                            url: AllergyIntolerance
                        - fullUrl: urn:uuid:7a0b6f5e-2c8d-5e1b-9d4f-5c6b7a8f9e03
                          resource:
                            resourceType: FamilyMemberHistory
                            id: 7a0b6f5e-2c8d-5e1b-9d4f-5c6b7a8f9e03
                            status: completed
                            patient:
                              reference: urn:uuid:a2b39d0e-7f15-5f6e-9e2a-3d7b8c1a9f01
                              type: Patient
                            relationship:
                              coding:
                                - system: >-
                                    http://terminology.hl7.org/CodeSystem/v3-RoleCode
                                  code: FTH
                                  display: Father
                              text: Father
                            condition:
                              - code:
                                  coding:
                                    - system: http://snomed.info/sct
                                      code: '195967001'
                                      display: Asthma
                                  text: Asthma
                          request:
                            method: POST
                            url: FamilyMemberHistory
                    usageInfo:
                      creditsConsumed: 42
                success_observation:
                  summary: >-
                    Known patient and encounter; note sent as titled sections;
                    only an observation found
                  value:
                    bundle:
                      resourceType: Bundle
                      type: transaction
                      timestamp: '2025-01-15T10:02:11.084512+00:00'
                      entry:
                        - fullUrl: urn:uuid:d4e5f6a7-b8c9-5d0e-8f1a-2b3c4d5e6f70
                          resource:
                            resourceType: Patient
                            id: d4e5f6a7-b8c9-5d0e-8f1a-2b3c4d5e6f70
                            identifier:
                              - system: http://corti.app/fhir/identifier/patient
                                value: MRN-00123
                          request:
                            method: POST
                            url: Patient
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/patient|MRN-00123
                        - fullUrl: urn:uuid:c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                          resource:
                            resourceType: Encounter
                            id: c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                            identifier:
                              - system: http://corti.app/fhir/identifier/encounter
                                value: c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                            status: finished
                            class:
                              system: http://terminology.hl7.org/CodeSystem/v3-ActCode
                              code: AMB
                              display: ambulatory
                            subject:
                              reference: urn:uuid:d4e5f6a7-b8c9-5d0e-8f1a-2b3c4d5e6f70
                              type: Patient
                          request:
                            method: POST
                            url: Encounter
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/encounter|c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                        - fullUrl: urn:uuid:9c2d8e7f-4a0b-5c3d-8e6f-7a8b9c0d1e25
                          resource:
                            resourceType: Observation
                            id: 9c2d8e7f-4a0b-5c3d-8e6f-7a8b9c0d1e25
                            status: final
                            category:
                              - coding:
                                  - system: >-
                                      http://terminology.hl7.org/CodeSystem/observation-category
                                    code: vital-signs
                                    display: Vital Signs
                                text: Vital Signs
                            code:
                              coding:
                                - system: http://loinc.org
                                  code: 8480-6
                                  display: Systolic blood pressure
                              text: Systolic blood pressure
                            valueQuantity:
                              value: 150
                              unit: mmHg
                              system: http://unitsofmeasure.org
                            subject:
                              reference: urn:uuid:d4e5f6a7-b8c9-5d0e-8f1a-2b3c4d5e6f70
                              type: Patient
                            encounter:
                              reference: urn:uuid:c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                              type: Encounter
                              identifier:
                                system: http://corti.app/fhir/identifier/encounter
                                value: c1d2e3f4-a5b6-5789-8c9d-0e1f2a3b4c5d
                            extension:
                              - url: >-
                                  https://docs.corti.ai/fhir/StructureDefinition/mention
                                extension:
                                  - url: field
                                    valueString: code
                                  - url: evidence
                                    extension:
                                      - url: start
                                        valueInteger: 50
                                      - url: end
                                        valueInteger: 73
                                      - url: text
                                        valueString: Systolic blood pressure
                                      - url: sectionId
                                        valueString: vitals
                                      - url: sectionStart
                                        valueInteger: 6
                                      - url: sectionEnd
                                        valueInteger: 29
                          request:
                            method: POST
                            url: Observation
                    usageInfo:
                      creditsConsumed: 23
                no_findings:
                  summary: >-
                    Note without clinical content; only the always-present
                    Patient and Encounter are returned
                  value:
                    bundle:
                      resourceType: Bundle
                      type: transaction
                      timestamp: '2025-01-15T10:05:32.270918+00:00'
                      entry:
                        - fullUrl: urn:uuid:e6f7a8b9-c0d1-5e2f-9a3b-4c5d6e7f8a92
                          resource:
                            resourceType: Patient
                            id: e6f7a8b9-c0d1-5e2f-9a3b-4c5d6e7f8a92
                            identifier:
                              - system: http://corti.app/fhir/identifier/patient
                                value: e6f7a8b9-c0d1-5e2f-9a3b-4c5d6e7f8a92
                          request:
                            method: POST
                            url: Patient
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/patient|e6f7a8b9-c0d1-5e2f-9a3b-4c5d6e7f8a92
                        - fullUrl: urn:uuid:f7a8b9c0-d1e2-5f3a-8b4c-5d6e7f8a9b03
                          resource:
                            resourceType: Encounter
                            id: f7a8b9c0-d1e2-5f3a-8b4c-5d6e7f8a9b03
                            identifier:
                              - system: http://corti.app/fhir/identifier/encounter
                                value: f7a8b9c0-d1e2-5f3a-8b4c-5d6e7f8a9b03
                            status: unknown
                            class:
                              extension:
                                - url: >-
                                    http://hl7.org/fhir/StructureDefinition/data-absent-reason
                                  valueCode: unknown
                            subject:
                              reference: urn:uuid:e6f7a8b9-c0d1-5e2f-9a3b-4c5d6e7f8a92
                              type: Patient
                          request:
                            method: POST
                            url: Encounter
                            ifNoneExist: >-
                              identifier=http://corti.app/fhir/identifier/encounter|f7a8b9c0-d1e2-5f3a-8b4c-5d6e7f8a9b03
                    usageInfo:
                      creditsConsumed: 5
        '400':
          description: >-
            RFC9457. Invalid request: a blank note (or a note whose section
            bodies are all blank), malformed JSON, an unknown `contextType`, an
            invalid enum value (for example `patient.gender` or
            `encounter.class`), or an invalid `resourceGroups` / `filters` entry
            (unknown resource group, category, field or coding system, a group
            listed twice, a filter that names no search the service performs).
            `detail` names the offending value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                empty_context:
                  summary: The note is blank, or every section body is blank
                  value:
                    requestid: 9f3e2d04-6f8b-4a5f-9d1c-2e7b8a6c1d3f
                    status: 400
                    type: about:blank
                    detail: >-
                      Request context is empty. Provide a non-empty note or at
                      least one non-empty section.
                invalid_category:
                  summary: >-
                    A category that does not belong to the selected resource
                    group
                  value:
                    requestid: 3c9a7e21-5b4d-4f8e-a1c6-7d2e9b0f4a58
                    status: 400
                    type: about:blank
                    detail: >-
                      Category 'vital-signs' is not a valid Condition category.
                      Valid values: ['encounter-diagnosis',
                      'problem-list-item'].
                duplicate_resource_group:
                  summary: A resource group listed twice
                  value:
                    requestid: 6b1f0d83-2e7a-4c95-b4d8-0a3f6e1c9b72
                    status: 400
                    type: about:blank
                    detail: >-
                      Resource group 'Observation' is listed twice in
                      'resourceGroups'.
        '403':
          description: RFC9457
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: >-
            RFC9457. The clinical note is longer than 256,000 characters,
            section titles included.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                note_too_long:
                  summary: The clinical note exceeds the maximum allowed length
                  value:
                    requestid: 8f14e45f-ceea-167a-5a36-dedd4bea2543
                    status: 413
                    type: about:blank
                    detail: >-
                      Clinical note is 300000 characters, which exceeds the
                      maximum of 256000.
        '422':
          description: >-
            RFC9457. The request body does not match the schema, for example a
            missing `context`, an empty `resourceGroups` or `categories` list, a
            `patient.birthDate` that is not a FHIR R4 date, or an
            `encounter.period` bound that is not a FHIR R4 dateTime. `detail`
            lists each failing field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_birth_date:
                  summary: A birth date with a free-text format
                  value:
                    requestid: 2d7e4b19-8a3c-4f60-b5e2-9c1a0d6f3e84
                    status: 422
                    type: about:blank
                    detail: >-
                      Invalid request input. patient.birthDate: Value error,
                      must be an ISO 8601 date (YYYY, YYYY-MM or YYYY-MM-DD; no
                      time of day, no relative or free-text dates)
        '500':
          description: >-
            RFC9457. Any other failure, including an error or timeout of the
            prediction service. Not billed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
    X-Corti-Retention-Policy:
      name: X-Corti-Retention-Policy
      in: header
      description: >-
        With the optional header `X-Corti-Retention-Policy: none`, the API
        processes the request as expected, but does not retain data. Endpoints
        that persist data do not save it. Endpoints that do not persist data
        leave no record of the request. The response includes the header
        `X-Corti-Retention-Policy: acknowledged` to confirm that the API applied
        the retention preference. If you omit the header or set it to any other
        value, the default retention policy applies and the API retains the
        data.
      required: false
      schema:
        type: string
        enum:
          - none
  schemas:
    FhirPredictRequest:
      type: object
      description: Request body of `/tools/fhir/`.
      required:
        - context
      properties:
        context:
          description: >-
            The clinical note: one string (`contextType: other`) or titled
            sections (`contextType: clinicalNote`). Evidence offsets in the
            response are character positions in the note; see the endpoint
            description. At most 256,000 characters, section titles included.
          oneOf:
            - $ref: '#/components/schemas/CommonContextString'
            - $ref: '#/components/schemas/CommonContextClinicalNote'
          discriminator:
            propertyName: contextType
            mapping:
              other: '#/components/schemas/CommonContextString'
              clinicalNote: '#/components/schemas/CommonContextClinicalNote'
        patient:
          $ref: '#/components/schemas/FhirPatientInput'
          description: >-
            Known facts about the patient. Every supplied field overrides the
            value the model extracts from the note; omitted fields fall back to
            extraction.
        encounter:
          $ref: '#/components/schemas/FhirEncounterInput'
          description: >-
            Known facts about the encounter during which the note was written.
            Every supplied field overrides the value the model extracts from the
            note; omitted fields fall back to extraction.
        resourceGroups:
          type: array
          minItems: 1
          description: >-
            Selection: the resource groups to produce, each optionally narrowed
            to categories. Omit to produce every resource group with every
            category; an empty list is rejected. Listing a group twice is
            rejected (400). Patient and Encounter are always produced, whether
            or not they are listed.
          items:
            $ref: '#/components/schemas/FhirResourceGroupSelection'
        filters:
          type: array
          description: >-
            Restriction: code filters, one per coding system, each optionally
            scoped to a resource group, category and coded field. Entries whose
            scopes match the same search are combined: includes are intersected,
            excludes are united. A filter that matches no search the service
            performs is rejected (400), so no filter is silently ignored. Omit
            for no restriction.
          items:
            $ref: '#/components/schemas/FhirCodeFilter'
    FhirPredictResponse:
      type: object
      description: >-
        Response of `/tools/fhir/` — the clinical facts found in the note as
        FHIR R4 resources, and the credits consumed. Fields without a value are
        omitted, never set to `null`.
      required:
        - bundle
        - usageInfo
      properties:
        bundle:
          $ref: '#/components/schemas/FhirBundle'
          description: The extracted clinical facts as FHIR R4 resources.
        usageInfo:
          $ref: '#/components/schemas/CommonUsageInfo'
          description: Credits consumed for this request.
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
    CommonContextString:
      type: object
      title: String
      description: The clinical note as one string.
      required:
        - contextType
        - data
      properties:
        contextType:
          type: string
          enum:
            - other
          description: Always `other` for a note sent as one string.
        data:
          type: string
          description: The note. A blank string is rejected (400).
          example: Known asthma, now with a cough.
    CommonContextClinicalNote:
      type: object
      title: Clinical note
      description: >-
        The clinical note as titled sections. The service writes the sections
        into one note in order, each as `"<title>:\n<body>\n\n"`. A note whose
        section bodies are all blank is rejected (400).
      required:
        - contextType
        - data
      properties:
        contextType:
          type: string
          enum:
            - clinicalNote
          description: Always `clinicalNote` for a note sent as sections.
        data:
          type: array
          description: The sections of the note, in order.
          items:
            $ref: '#/components/schemas/CommonContextClinicalNoteSection'
    FhirPatientInput:
      type: object
      description: >-
        Known facts about the patient (FHIR R4 Patient subset) that override
        model extraction.
      properties:
        identifier:
          type: string
          description: >-
            Business identifier of the patient in the caller's system (FHIR R4
            `Patient.identifier.value`). When provided, the returned Patient
            resource uses this identifier instead of a generated one. It never
            replaces the resource `id`.
          example: MRN-00123
        gender:
          type: string
          enum:
            - male
            - female
            - other
            - unknown
          description: >-
            Administrative gender (FHIR R4 `Patient.gender`,
            http://hl7.org/fhir/ValueSet/administrative-gender).
        birthDate:
          type: string
          pattern: ^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01]))?)?$
          description: >-
            Date of birth as a FHIR R4 `date`: `YYYY`, `YYYY-MM` or
            `YYYY-MM-DD`. No time of day, no relative or free-text dates.
          example: '1974-12-25'
        name:
          type: string
          description: >-
            The patient's name as plain text. Returned as
            `Patient.name[0].text`; never split into given and family parts.
          example: Maria Nielsen
    FhirEncounterInput:
      type: object
      description: >-
        Known facts about the encounter (FHIR R4 Encounter subset) that override
        model extraction.
      properties:
        identifier:
          type: string
          description: >-
            Business identifier of the encounter in the caller's system (FHIR R4
            `Encounter.identifier.value`). When provided, the returned Encounter
            resource uses this identifier instead of a generated one. It never
            replaces the resource `id`.
          example: '123456789'
        status:
          type: string
          enum:
            - planned
            - arrived
            - triaged
            - in-progress
            - onleave
            - finished
            - cancelled
            - entered-in-error
            - unknown
          description: >-
            Encounter status (FHIR R4 `Encounter.status`,
            http://hl7.org/fhir/ValueSet/encounter-status).
        class:
          type: string
          enum:
            - ambulatory
            - emergency
            - inpatient
            - home-health
            - virtual
          description: >-
            Care setting of the encounter (FHIR R4 `Encounter.class`, coded in
            the v3-ActCode system: AMB, EMER, IMP, HH, VR).
        type:
          type: string
          description: Specific type of the encounter, free text.
        serviceType:
          type: string
          description: Broad category of the service, free text.
        priority:
          type: string
          enum:
            - routine
            - urgent
            - emergency
            - asap
            - elective
            - stat
          description: >-
            Urgency of the encounter (FHIR R4 `Encounter.priority`,
            v3-ActPriority).
        reasonCode:
          type: string
          description: Chief complaint or reason for the visit, free text.
        period:
          $ref: '#/components/schemas/FhirPeriodInput'
          description: Start and end of the encounter, FHIR R4 dateTimes.
    FhirResourceGroupSelection:
      type: object
      description: >-
        One selected resource group and, optionally, the categories to produce
        within it.
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/FhirResourceGroup'
          description: The resource group to produce.
        categories:
          type: array
          minItems: 1
          description: >-
            Categories to produce within this group. Omit for all categories.
            Only resources whose category is selected are returned. Each value
            must belong to this group's category set (400 otherwise):
            Observation — `laboratory`, `vital-signs`, `survey`, `exam`,
            `social-history`, `imaging`, `procedure`; Condition —
            `problem-list-item`, `encounter-diagnosis`; AllergyIntolerance —
            `food`, `medication`, `environment`, `biologic`; Procedure — the
            SNOMED CT procedure categories listed in the enum. Patient,
            Encounter and FamilyMemberHistory have no categories and reject this
            field.
          items:
            type: string
            enum:
              - laboratory
              - vital-signs
              - survey
              - exam
              - social-history
              - imaging
              - procedure
              - problem-list-item
              - encounter-diagnosis
              - food
              - medication
              - environment
              - biologic
              - Psychiatry procedure or service
              - Counseling
              - Education
              - Surgical procedure
              - Laboratory test
              - Imaging
              - Measurement
              - Chiropractic manipulation
              - Social service procedure
          example:
            - vital-signs
            - laboratory
    FhirCodeFilter:
      type: object
      description: >-
        Restricts the codes the service may return for one coding system.
        Without a `scope`, the entry applies to every `code` search of its
        system across all selected resource groups; `bodySite` and
        `valueCodeableConcept` searches are only restricted by entries that name
        the field in `scope.field`.
      required:
        - systemId
      properties:
        systemId:
          type: string
          pattern: ^[a-z0-9]+$
          description: >-
            Coding system the filter applies to, written without hyphens, e.g.
            `snomedctint` or `loinc`. Must be a system the service searches for
            the scope; any other value is rejected (400).
          example: snomedctint
        include:
          $ref: '#/components/schemas/FhirFilterConditionGroup'
          description: Codes that may be returned. Omit to allow every code of the system.
        exclude:
          $ref: '#/components/schemas/FhirFilterConditionGroup'
          description: Codes that must not be returned, subtracted from the include set.
        scope:
          $ref: '#/components/schemas/FhirFilterScope'
          description: Where the entry applies. Omit to apply it everywhere for `systemId`.
    FhirBundle:
      type: object
      description: >-
        A FHIR R4 Bundle of type `transaction`
        (https://hl7.org/fhir/R4/bundle.html). POSTed as-is to the base URL of a
        FHIR R4 server, the server creates every resource and rewrites the
        bundle-local `urn:uuid` references to the ids it assigns. The first
        entry is always the Patient and the second the Encounter; the clinical
        resources follow, grouped by `resourceType`. The same `resourceType` may
        appear more than once, for example once per condition found.
      required:
        - resourceType
        - type
      properties:
        resourceType:
          type: string
          enum:
            - Bundle
          description: FHIR resource type discriminator; always `Bundle`.
        type:
          type: string
          enum:
            - transaction
          description: Bundle type; always `transaction` for this endpoint.
        timestamp:
          type: string
          format: date-time
          description: When the response was produced.
          example: '2025-01-15T09:30:47.512034+00:00'
        entry:
          type: array
          description: >-
            The extracted resources, one per entry. Always holds the Patient and
            the Encounter; a Bundle with only those two is a successful response
            for a note without clinical content.
          items:
            $ref: '#/components/schemas/FhirBundleEntry'
    CommonUsageInfo:
      type: object
      description: Credits consumed for this request.
      required:
        - creditsConsumed
      properties:
        creditsConsumed:
          type: number
    CommonContextClinicalNoteSection:
      type: object
      description: One titled section of a clinical note.
      required:
        - id
        - title
        - body
      properties:
        id:
          type: string
          description: >-
            Your id for the section; returned as `sectionId` on evidence spans
            inside it.
          example: vitals
        title:
          type: string
          description: Section title, written into the note as `<title>:` on its own line.
          example: Vitals
        body:
          type: string
          description: Section text.
          example: Systolic blood pressure is 150 mmHg.
    FhirPeriodInput:
      type: object
      description: >-
        A time range (FHIR R4 Period). Each bound is a FHIR R4 `dateTime`:
        `YYYY`, `YYYY-MM`, `YYYY-MM-DD`, or a full date with a time of day that
        includes seconds and a time zone. A time without a time zone (e.g.
        `2025-01-15T09:00`) is rejected, because the service never invents one.
      properties:
        start:
          type: string
          pattern: >-
            ^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01])(T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d+)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)))?)?)?$
          description: Start of the period, FHIR R4 dateTime.
          example: '2025-01-15T09:00:00Z'
        end:
          type: string
          pattern: >-
            ^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01])(T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d+)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)))?)?)?$
          description: >-
            End of the period, inclusive, FHIR R4 dateTime. The period is
            ongoing while `end` is missing.
          example: '2025-01-15T09:45:00Z'
    FhirResourceGroup:
      type: string
      description: >-
        A FHIR R4 resource type the service can produce. Patient and Encounter
        are always produced.
      enum:
        - Condition
        - AllergyIntolerance
        - FamilyMemberHistory
        - Procedure
        - Observation
        - Patient
        - Encounter
    FhirFilterConditionGroup:
      type: object
      description: >-
        Conditions combined with AND (`match: all`) or OR (`match: any`). An
        item of `conditions` may itself be a group, to mix AND and OR, up to
        three levels deep.
      required:
        - conditions
      properties:
        match:
          type: string
          enum:
            - all
            - any
          description: >-
            How `conditions` combine. May be omitted only when `conditions` has
            a single item.
        conditions:
          type: array
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/CodesFilterCondition'
              - $ref: '#/components/schemas/FhirFilterConditionGroup'
      example:
        match: all
        conditions:
          - property: code
            op: is-a
            value:
              - '50043002'
    FhirFilterScope:
      type: object
      description: >-
        Where a filter entry applies. Each key is optional; an omitted key
        matches everything. The combination of `resourceGroup`, `field` and the
        entry's `systemId` must name a search the service performs (400
        otherwise).
      properties:
        resourceGroup:
          $ref: '#/components/schemas/FhirResourceGroup'
          description: Resource group the entry applies to. Omit for every group.
        category:
          type: string
          description: >-
            A category of `resourceGroup` (see
            `FhirResourceGroupSelection.categories`). Requires `resourceGroup`;
            a category the `resourceGroups` selection deselects is rejected
            (400).
          example: problem-list-item
        field:
          type: string
          enum:
            - code
            - bodySite
            - valueCodeableConcept
          default: code
          description: >-
            Coded element the filter restricts: `code` (the resource's main
            code, e.g. `Condition.code` or
            `FamilyMemberHistory.condition.code`), `bodySite` (the anatomical
            site), or `valueCodeableConcept` (the coded finding of an imaging
            observation).
    FhirBundleEntry:
      type: object
      description: One entry of the FHIR Bundle (`Bundle.entry`).
      required:
        - fullUrl
        - resource
        - request
      properties:
        fullUrl:
          type: string
          description: >-
            Bundle-local address of the resource, `urn:uuid:<resource.id>`.
            References inside the Bundle point at this value.
          example: urn:uuid:3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        resource:
          description: >-
            One FHIR R4 resource extracted from the note. One of: Patient,
            Encounter, Condition, AllergyIntolerance, FamilyMemberHistory,
            Procedure, Observation. New resource types may be added in the
            future; ignore entries whose `resourceType` you do not recognize.
          anyOf:
            - $ref: '#/components/schemas/FhirPatient'
            - $ref: '#/components/schemas/FhirEncounter'
            - $ref: '#/components/schemas/FhirCondition'
            - $ref: '#/components/schemas/FhirAllergyIntolerance'
            - $ref: '#/components/schemas/FhirFamilyMemberHistory'
            - $ref: '#/components/schemas/FhirProcedure'
            - $ref: '#/components/schemas/FhirObservation'
          discriminator:
            propertyName: resourceType
            mapping:
              Patient: '#/components/schemas/FhirPatient'
              Encounter: '#/components/schemas/FhirEncounter'
              Condition: '#/components/schemas/FhirCondition'
              AllergyIntolerance: '#/components/schemas/FhirAllergyIntolerance'
              FamilyMemberHistory: '#/components/schemas/FhirFamilyMemberHistory'
              Procedure: '#/components/schemas/FhirProcedure'
              Observation: '#/components/schemas/FhirObservation'
        request:
          $ref: '#/components/schemas/FhirBundleEntryRequest'
          description: How a FHIR server processes the entry in the transaction.
    CodesFilterCondition:
      type: object
      description: >-
        Single property/op/value filter clause for attribute-based code
        filtering.
      required:
        - property
        - value
      properties:
        property:
          type: string
          description: The attribute to filter on.
          example: code
        op:
          type: string
          enum:
            - '='
            - is-a
            - descendent-of
            - exists
            - in
          default: '='
          description: >-
            Comparison operator: `=` (equal), `is-a` (code plus descendants),
            `descendent-of` (strict descendants), `exists` (`value:
            true`/`false` for set/unset), `in` (membership).
        value:
          description: Comparison value; type depends on `op`.
          oneOf:
            - type: string
            - type: boolean
            - type: integer
            - type: array
              items:
                type: string
    FhirPatient:
      type: object
      description: >-
        The patient of the clinical note (FHIR R4 Patient,
        https://hl7.org/fhir/R4/patient.html). Demographics are extracted from
        the note; the request's `patient` fields override. Always present in the
        Bundle, even when the note says nothing about the patient.
      required:
        - resourceType
        - id
      properties:
        resourceType:
          type: string
          enum:
            - Patient
          description: FHIR resource type discriminator; always `Patient`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        identifier:
          type: array
          description: Business identifiers of the patient.
          items:
            $ref: '#/components/schemas/FhirIdentifier'
        active:
          type: boolean
          description: Whether this patient's record is in active use.
        gender:
          type: string
          enum:
            - male
            - female
            - other
            - unknown
          description: Administrative gender.
          example: female
        birthDate:
          type: string
          description: Date of birth, ISO 8601 (`YYYY-MM-DD`).
          example: '1974-12-25'
        name:
          type: array
          description: >-
            The patient's name, as written in the note or overridden by the
            request's `patient.name`. Omitted when neither states one.
          items:
            $ref: '#/components/schemas/FhirHumanName'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirEncounter:
      type: object
      description: >-
        The encounter during which the note was written (FHIR R4 Encounter,
        https://hl7.org/fhir/R4/encounter.html). Context is extracted from the
        note; the request's `encounter` fields override. Always present in the
        Bundle, even when the note says nothing about the encounter.
      required:
        - resourceType
        - id
        - status
        - class
      properties:
        resourceType:
          type: string
          enum:
            - Encounter
          description: FHIR resource type discriminator; always `Encounter`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        identifier:
          type: array
          description: Business identifiers of the encounter.
          items:
            $ref: '#/components/schemas/FhirIdentifier'
        status:
          type: string
          enum:
            - planned
            - arrived
            - triaged
            - in-progress
            - onleave
            - finished
            - cancelled
            - entered-in-error
            - unknown
          description: >-
            Encounter status; `unknown` when the note and the request do not
            state it.
          example: in-progress
        class:
          $ref: '#/components/schemas/FhirCoding'
          description: >-
            The care setting. A Coding from the v3-ActCode system: AMB
            (ambulatory), EMER (emergency), IMP (inpatient), HH (home health),
            VR (virtual). Only the data-absent-reason extension when the note
            and the request do not state it.
        subject:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        type:
          type: array
          description: Specific type of the encounter.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        serviceType:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Broad category of the service, e.g. cardiology.
        priority:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Urgency of the encounter, e.g. `routine` or `emergency`.
        reasonCode:
          type: array
          description: Reasons for the encounter, e.g. the chief complaint.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        period:
          $ref: '#/components/schemas/FhirPeriod'
          description: Start and end of the encounter.
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirCondition:
      type: object
      description: >-
        A condition, problem, or diagnosis found in the note (FHIR R4 Condition,
        https://hl7.org/fhir/R4/condition.html), e.g. asthma. Produced once per
        condition found. The note text that grounds each field and the competing
        codes ride in extensions (`FhirMentionExtension`,
        `FhirAlternativeExtension`).
      required:
        - resourceType
        - id
      properties:
        resourceType:
          type: string
          enum:
            - Condition
          description: FHIR resource type discriminator; always `Condition`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        subject:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        code:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The condition, typically a SNOMED CT code.
        clinicalStatus:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: >-
            Whether the condition is active, resolved, and so on
            (http://terminology.hl7.org/CodeSystem/condition-clinical).
        verificationStatus:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Whether the condition is confirmed, provisional, refuted, and so on.
        category:
          type: array
          description: Category, e.g. `problem-list-item` or `encounter-diagnosis`.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        severity:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Severity, e.g. mild, moderate, or severe (SNOMED CT).
        bodySite:
          type: array
          description: Anatomical location, e.g. left knee.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        encounter:
          $ref: '#/components/schemas/FhirReference'
          description: The encounter this condition was recorded during.
        onsetDateTime:
          type: string
          description: When the condition began, ISO 8601 date-time.
          example: '2025-01-15T09:00:00Z'
        onsetString:
          type: string
          description: When the condition began, free text.
          example: since childhood
        onsetPeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: When the condition began, a time range.
        abatementDateTime:
          type: string
          description: When the condition resolved, ISO 8601 date-time.
        abatementString:
          type: string
          description: When the condition resolved, free text.
          example: last week
        abatementPeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: When the condition resolved, a time range.
        asserter:
          $ref: '#/components/schemas/FhirReference'
          description: Who reported the condition.
        stage:
          type: array
          description: Stage, e.g. a cancer stage.
          items:
            $ref: '#/components/schemas/FhirConditionStage'
        evidence:
          type: array
          description: Supporting manifestations of the condition.
          items:
            $ref: '#/components/schemas/FhirConditionEvidence'
        note:
          type: array
          description: Notes about the condition.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirAllergyIntolerance:
      type: object
      description: >-
        An allergy or intolerance found in the note (FHIR R4 AllergyIntolerance,
        https://hl7.org/fhir/R4/allergyintolerance.html), e.g. a penicillin
        allergy. Produced once per allergy found. The note text that grounds
        each field and the competing codes ride in extensions
        (`FhirMentionExtension`, `FhirAlternativeExtension`).
      required:
        - resourceType
        - id
      properties:
        resourceType:
          type: string
          enum:
            - AllergyIntolerance
          description: FHIR resource type discriminator; always `AllergyIntolerance`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        patient:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        code:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The substance or agent, e.g. penicillin (SNOMED CT).
        type:
          type: string
          enum:
            - allergy
            - intolerance
          description: >-
            Whether the record is an allergy or an intolerance
            (http://hl7.org/fhir/ValueSet/allergy-intolerance-type).
        category:
          type: array
          description: >-
            Category of the substance — food, medication, environment, or
            biologic
            (http://hl7.org/fhir/ValueSet/allergy-intolerance-category).
          items:
            type: string
            enum:
              - food
              - medication
              - environment
              - biologic
        clinicalStatus:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Whether the allergy is active, resolved, and so on.
        verificationStatus:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Whether the allergy is confirmed, refuted, and so on.
        criticality:
          type: string
          enum:
            - low
            - high
            - unable-to-assess
          description: >-
            Clinical risk of the allergy
            (http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality).
        reaction:
          type: array
          description: Reactions the patient had to the substance.
          items:
            $ref: '#/components/schemas/FhirAllergyIntoleranceReaction'
        onsetDateTime:
          type: string
          description: When the allergy first occurred, ISO 8601 date-time.
        onsetString:
          type: string
          description: When the allergy first occurred, free text.
        onsetPeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: When the allergy first occurred, a time range.
        encounter:
          $ref: '#/components/schemas/FhirReference'
          description: The encounter the allergy was recorded during.
        lastOccurrence:
          type: string
          description: When the last reaction occurred, ISO 8601 date-time.
        asserter:
          $ref: '#/components/schemas/FhirReference'
          description: Who reported the allergy.
        note:
          type: array
          description: Notes about the allergy.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirFamilyMemberHistory:
      type: object
      description: >-
        A disease of a relative of the patient (FHIR R4 FamilyMemberHistory,
        https://hl7.org/fhir/R4/familymemberhistory.html), e.g. a father with
        asthma. Produced once per relative found in the note.
      required:
        - resourceType
        - id
        - status
        - relationship
      properties:
        resourceType:
          type: string
          enum:
            - FamilyMemberHistory
          description: FHIR resource type discriminator; always `FamilyMemberHistory`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        patient:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        status:
          type: string
          enum:
            - partial
            - completed
            - entered-in-error
            - health-unknown
          description: Status of the family-history record.
        name:
          type: string
          description: The relative's name.
          example: Maria Nielsen
        relationship:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: >-
            The relation to the patient, coded in the v3-RoleCode family system,
            e.g. FTH (Father), MTH (Mother), or SIS (Sister); text only when the
            relation has no code; only the data-absent-reason extension when the
            note does not state it.
        sex:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The relative's sex, e.g. male or female (SNOMED CT).
        ageString:
          type: string
          description: The relative's age, free text.
          example: around 70
        deceasedString:
          type: string
          description: >-
            How the relative is deceased, free text; e.g. `died 2019` or
            `alive`.
        condition:
          type: array
          description: Conditions the relative has or had.
          items:
            $ref: '#/components/schemas/FhirFamilyMemberHistoryCondition'
        note:
          type: array
          description: Notes about the relative.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirProcedure:
      type: object
      description: >-
        A procedure found in the note (FHIR R4 Procedure,
        https://hl7.org/fhir/R4/procedure.html), e.g. a splint applied in the
        emergency department. Produced once per procedure found. The note text
        that grounds each field and the competing codes ride in extensions
        (`FhirMentionExtension`, `FhirAlternativeExtension`).
      required:
        - resourceType
        - id
        - status
      properties:
        resourceType:
          type: string
          enum:
            - Procedure
          description: FHIR resource type discriminator; always `Procedure`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        subject:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        status:
          type: string
          enum:
            - preparation
            - in-progress
            - not-done
            - on-hold
            - stopped
            - completed
            - entered-in-error
            - unknown
          description: >-
            Status of the procedure
            (http://hl7.org/fhir/ValueSet/procedure-status).
          example: completed
        category:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Category of the procedure, e.g. `surgical procedure`.
        code:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: What was done, typically a SNOMED CT code.
        encounter:
          $ref: '#/components/schemas/FhirReference'
          description: The encounter the procedure was performed during.
        performedDateTime:
          type: string
          description: When the procedure was performed, ISO 8601 date-time.
        performedString:
          type: string
          description: When the procedure was performed, free text.
        performedPeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: When the procedure was performed, a time range.
        performer:
          type: array
          description: Who performed the procedure and in which role.
          items:
            $ref: '#/components/schemas/FhirProcedurePerformer'
        reasonCode:
          type: array
          description: Why the procedure was performed.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        bodySite:
          type: array
          description: Anatomical site of the procedure.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        outcome:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Outcome of the procedure, e.g. `successful`.
        complication:
          type: array
          description: Complications of the procedure.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        asserter:
          $ref: '#/components/schemas/FhirReference'
          description: Who reported the procedure.
        partOf:
          type: array
          description: Procedures this procedure is part of.
          items:
            $ref: '#/components/schemas/FhirReference'
        note:
          type: array
          description: Notes about the procedure.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirObservation:
      type: object
      description: >-
        A measurement or finding from the note (FHIR R4 Observation,
        https://hl7.org/fhir/R4/observation.html), e.g. blood pressure or HbA1c.
        Produced once per observation found. The note text that grounds each
        field and the competing codes ride in extensions
        (`FhirMentionExtension`, `FhirAlternativeExtension`).
      required:
        - resourceType
        - id
        - status
        - code
      properties:
        resourceType:
          type: string
          enum:
            - Observation
          description: FHIR resource type discriminator; always `Observation`.
        id:
          type: string
          description: >-
            Bundle-local logical id of the resource (a UUID); the entry's
            `fullUrl` is `urn:uuid:<id>`.
          example: 3f6d2b1a-8c4e-5a7d-b9f0-1e2d3c4b5a69
        subject:
          $ref: '#/components/schemas/FhirReference'
          description: The patient, a reference to the Bundle's Patient.
        status:
          type: string
          enum:
            - registered
            - preliminary
            - final
            - amended
            - corrected
            - cancelled
            - entered-in-error
            - unknown
          description: >-
            Status of the observation
            (http://hl7.org/fhir/ValueSet/observation-status).
          example: final
        category:
          type: array
          description: Category of the observation, e.g. `vital-signs`.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        code:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: What was observed or measured, typically a LOINC or SNOMED CT code.
        valueQuantity:
          $ref: '#/components/schemas/FhirQuantity'
          description: The observed value as a number with a unit.
        valueCodeableConcept:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The observed value as a coded finding.
        valueInteger:
          type: integer
          description: The observed value as an integer.
        valueRatio:
          $ref: '#/components/schemas/FhirRatio'
          description: The observed value as a ratio.
        valueString:
          type: string
          description: The observed value as text.
        dataAbsentReason:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Why the observation carries no value.
        interpretation:
          type: array
          description: Assessment of the value, e.g. `high` or `low`.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        encounter:
          $ref: '#/components/schemas/FhirReference'
          description: The encounter the observation was taken during.
        effectiveDateTime:
          type: string
          description: When the measurement was taken, ISO 8601 date-time.
        effectivePeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: Over which time span the measurement was taken.
        bodySite:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The site of the measurement.
        method:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: How the measurement was taken.
        note:
          type: array
          description: Notes about the observation.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
        extension:
          $ref: '#/components/schemas/FhirResourceExtensions'
    FhirBundleEntryRequest:
      type: object
      description: >-
        The transaction instruction of one entry (FHIR R4
        `Bundle.entry.request`): every entry is a create (`POST`) of its
        resource type.
      required:
        - method
        - url
      properties:
        method:
          type: string
          enum:
            - POST
          description: Always `POST`.
        url:
          type: string
          description: The resource type the entry is created as.
          example: Condition
        ifNoneExist:
          type: string
          description: >-
            Set on the Patient and Encounter entries only: a conditional create
            on the business identifier (`identifier=<system>|<value>`,
            URL-encoded). A server that already holds a resource with that
            identifier links the Bundle to it instead of creating a duplicate.
          example: identifier=http://corti.app/fhir/identifier/patient|MRN-00123
    FhirIdentifier:
      type: object
      description: >-
        An identifier of a patient, encounter, or other entity inside a
        namespace (FHIR R4 Identifier,
        https://hl7.org/fhir/R4/datatypes.html#Identifier). The service uses the
        systems `http://corti.app/fhir/identifier/patient` and
        `http://corti.app/fhir/identifier/encounter`; the value is the request's
        `patient.identifier` / `encounter.identifier`, or the resource `id` when
        the request supplies none.
      properties:
        system:
          type: string
          description: Namespace of the identifier.
          example: http://corti.app/fhir/identifier/patient
        value:
          type: string
          description: The identifier value, e.g. a medical record number.
          example: MRN-00123
    FhirHumanName:
      type: object
      description: >-
        A person's name (FHIR R4 HumanName,
        https://hl7.org/fhir/R4/datatypes.html#HumanName). Only `text` is set:
        the name exactly as stated, never split into given and family parts.
      properties:
        text:
          type: string
          description: The full name as plain text.
          example: Maria Nielsen
    FhirResourceExtensions:
      type: array
      description: >-
        Extensions attached to a FHIR resource (FHIR R4
        `DomainResource.extension`). The service produces two extension types
        today: `mention` (evidence spans that ground the resource in the note)
        and `alternative` (competing codes). Ignore extensions whose `url` you
        do not recognize; new extension types may be added in the future.
      items:
        anyOf:
          - $ref: '#/components/schemas/FhirMentionExtension'
          - $ref: '#/components/schemas/FhirAlternativeExtension'
    FhirCoding:
      type: object
      description: >-
        A code and the terminology system it comes from (FHIR R4 Coding,
        https://hl7.org/fhir/R4/datatypes.html#Coding). An `Encounter.class` the
        note does not state carries only `extension` (data-absent-reason) and no
        code.
      properties:
        extension:
          type: array
          description: >-
            Set instead of a value when FHIR R4 requires this element and the
            note does not state it.
          items:
            $ref: '#/components/schemas/FhirDataAbsentReasonExtension'
        system:
          type: string
          description: >-
            Identity of the terminology system. Common systems:
            `http://snomed.info/sct` (SNOMED CT),
            `http://hl7.org/fhir/sid/icd-10-cm` (ICD-10-CM), `http://loinc.org`
            (LOINC), `http://terminology.hl7.org/CodeSystem/v3-ActCode`
            (encounter class).
          example: http://snomed.info/sct
        version:
          type: string
          description: Version of the terminology system, when relevant.
        code:
          type: string
          description: The code inside the system.
          example: '195967001'
        display:
          type: string
          description: Human-readable text of the code.
          example: Asthma
    FhirReference:
      type: object
      description: >-
        A reference from one resource to another (FHIR R4 Reference,
        https://hl7.org/fhir/R4/references.html). Inside the returned Bundle,
        resources refer to each other with `urn:uuid` references. References to
        people the note names (`asserter`, `performer.actor`) and to containing
        events (`Procedure.partOf`) carry only `display`, since no resource for
        them exists in the Bundle.
      properties:
        extension:
          type: array
          description: >-
            Set instead of a value when FHIR R4 requires this element and the
            note does not state it.
          items:
            $ref: '#/components/schemas/FhirDataAbsentReasonExtension'
        reference:
          type: string
          description: >-
            The referenced resource, e.g. `urn:uuid:b7c4e1d9-...`; equal to the
            `fullUrl` of an entry of the Bundle.
          example: urn:uuid:b7c4e1d9-2a3f-4c8b-9d5e-6f0a1b2c3d7e
        type:
          type: string
          description: Resource type of the reference target.
          example: Encounter
        identifier:
          $ref: '#/components/schemas/FhirIdentifier'
          description: >-
            Business identifier of the referenced resource. Set on `encounter`
            references, so they also identify the caller's encounter.
        display:
          type: string
          description: Text alternative for the referenced resource.
    FhirCodeableConcept:
      type: object
      description: >-
        A clinical concept: one or more codes from one or more terminology
        systems, plus a plain-text representation (FHIR R4 CodeableConcept,
        https://hl7.org/fhir/R4/datatypes.html#CodeableConcept). When several
        codings appear, they express the same concept in different systems. A
        required concept the note does not state
        (`FamilyMemberHistory.relationship`,
        `AllergyIntolerance.reaction.manifestation`) carries only `extension`
        (data-absent-reason).
      properties:
        extension:
          type: array
          description: >-
            Set instead of a value when FHIR R4 requires this element and the
            note does not state it.
          items:
            $ref: '#/components/schemas/FhirDataAbsentReasonExtension'
        coding:
          type: array
          description: The coded forms of the concept.
          items:
            $ref: '#/components/schemas/FhirCoding'
        text:
          type: string
          description: Human-readable plain-text form of the concept.
          example: Asthma
    FhirPeriod:
      type: object
      description: >-
        A time range with a start and an end (FHIR R4 Period,
        https://hl7.org/fhir/R4/datatypes.html#Period).
      properties:
        start:
          type: string
          description: Start of the period, ISO 8601 date-time.
          example: '2025-01-15T09:00:00Z'
        end:
          type: string
          description: >-
            End of the period, inclusive, ISO 8601 date-time. The period is
            ongoing while `end` is missing.
          example: '2025-01-15T09:45:00Z'
    FhirConditionStage:
      type: object
      description: >-
        Stage of a condition (FHIR R4 `Condition.stage`,
        https://hl7.org/fhir/R4/condition-definitions.html).
      properties:
        summary:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Simple summary of the stage, e.g. the cancer stage.
        assessment:
          type: array
          description: References to the formal assessment records.
          items:
            $ref: '#/components/schemas/FhirReference'
        type:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Kind of staging, e.g. TNM.
    FhirConditionEvidence:
      type: object
      description: Supporting evidence for a condition (FHIR R4 `Condition.evidence`).
      properties:
        code:
          type: array
          description: Manifestations that support the condition.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        detail:
          type: array
          description: References to resources that support the condition.
          items:
            $ref: '#/components/schemas/FhirReference'
    FhirAnnotation:
      type: object
      description: >-
        A free-text note (FHIR R4 Annotation,
        https://hl7.org/fhir/R4/datatypes.html#Annotation).
      required:
        - text
      properties:
        text:
          type: string
          description: The text of the note.
    FhirAllergyIntoleranceReaction:
      type: object
      description: >-
        One reaction to an allergy (FHIR R4 `AllergyIntolerance.reaction`,
        http://hl7.org/fhir/R4/allergyintolerance-definitions.html).
      required:
        - manifestation
      properties:
        substance:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The substance that caused the reaction, when known.
        manifestation:
          type: array
          minItems: 1
          description: >-
            Clinical signs of the reaction, e.g. rash or anaphylaxis. When the
            note states none, a single concept carrying only the
            data-absent-reason extension.
          items:
            $ref: '#/components/schemas/FhirCodeableConcept'
        description:
          type: string
          description: Text description of the reaction.
          example: rash
        onset:
          type: string
          description: When the reaction began, ISO 8601 date-time.
        severity:
          type: string
          enum:
            - mild
            - moderate
            - severe
          description: >-
            Severity of the reaction
            (http://hl7.org/fhir/ValueSet/reaction-event-severity).
        exposureRoute:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: How the exposure occurred, e.g. oral or intravenous.
    FhirFamilyMemberHistoryCondition:
      type: object
      description: >-
        One condition of a family member (FHIR R4
        `FamilyMemberHistory.condition`,
        https://hl7.org/fhir/R4/familymemberhistory-definitions.html).
      required:
        - code
      properties:
        code:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The condition, e.g. asthma (SNOMED CT).
        outcome:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The outcome of the condition for the relative.
        contributedToDeath:
          type: boolean
          description: Whether the condition contributed to the relative's death.
        onsetString:
          type: string
          description: When the condition began, free text.
          example: in childhood
        onsetPeriod:
          $ref: '#/components/schemas/FhirPeriod'
          description: When the condition began, a time range.
        onsetAge:
          $ref: '#/components/schemas/FhirQuantity'
          description: >-
            The age at which the condition began (Quantity with a UCUM time
            unit).
        onsetRange:
          $ref: '#/components/schemas/FhirRange'
          description: The age range at which the condition began.
        note:
          type: array
          description: Notes about the condition.
          items:
            $ref: '#/components/schemas/FhirAnnotation'
    FhirProcedurePerformer:
      type: object
      description: >-
        Who performed a procedure (FHIR R4 `Procedure.performer`,
        https://hl7.org/fhir/R4/procedure-definitions.html).
      required:
        - actor
      properties:
        function:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: Role of the performer, e.g. surgeon or anesthetist.
        actor:
          $ref: '#/components/schemas/FhirReference'
          description: >-
            The practitioner who performed, as a display-only reference, or only
            the data-absent-reason extension when the note does not name them.
        onBehalfOf:
          $ref: '#/components/schemas/FhirReference'
          description: The organization the performer acted for.
    FhirQuantity:
      type: object
      description: >-
        A measured amount with a unit (FHIR R4 Quantity,
        https://hl7.org/fhir/R4/datatypes.html#Quantity).
      properties:
        value:
          type: number
          description: The numeric value.
          example: 150
        comparator:
          type: string
          enum:
            - <
            - <=
            - '>='
            - '>'
          description: How the value relates to its reference range.
        unit:
          type: string
          description: Human-readable unit.
          example: mmHg
        system:
          type: string
          description: >-
            The system the unit code comes from, e.g.
            `http://unitsofmeasure.org` (UCUM).
          example: http://unitsofmeasure.org
        code:
          type: string
          description: Coded form of the unit.
          example: mmHg
    FhirRatio:
      type: object
      description: >-
        A ratio of two quantities (FHIR R4 Ratio), e.g. a titration or a ratio
        measurement.
      properties:
        numerator:
          $ref: '#/components/schemas/FhirQuantity'
        denominator:
          $ref: '#/components/schemas/FhirQuantity'
    FhirMentionExtension:
      type: object
      description: >-
        Evidence the model located in the clinical note, attached to one field
        of a resource as a FHIR R4 extension with the fixed URL
        `https://docs.corti.ai/fhir/StructureDefinition/mention`. Repeated once
        per field: each occurrence names the supported element in a `field`
        sub-extension, then carries one `evidence` block per span found.
      required:
        - url
        - extension
      properties:
        url:
          type: string
          enum:
            - https://docs.corti.ai/fhir/StructureDefinition/mention
          description: Identifies this extension as evidence.
        extension:
          type: array
          minItems: 2
          description: >-
            One `field` sub-extension, then one or more `evidence`
            sub-extensions.
          items:
            anyOf:
              - $ref: '#/components/schemas/FhirFieldSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceSubExtension'
    FhirAlternativeExtension:
      type: object
      description: >-
        A competing code the model considered but did not select, attached to
        one field of a resource as a FHIR R4 extension with the fixed URL
        `https://docs.corti.ai/fhir/StructureDefinition/alternative`. Repeated
        once per field: each occurrence names the element in a `field`
        sub-extension, then carries one `alternative` sub-extension per
        competing code.
      required:
        - url
        - extension
      properties:
        url:
          type: string
          enum:
            - https://docs.corti.ai/fhir/StructureDefinition/alternative
          description: Identifies this extension as a competing-code alternative.
        extension:
          type: array
          minItems: 2
          description: >-
            One `field` sub-extension, then one or more `alternative`
            sub-extensions.
          items:
            anyOf:
              - $ref: '#/components/schemas/FhirFieldSubExtension'
              - $ref: '#/components/schemas/FhirAlternativeSubExtension'
    FhirDataAbsentReasonExtension:
      type: object
      description: >-
        The core FHIR R4 data-absent-reason extension
        (http://hl7.org/fhir/R4/extension-data-absent-reason.html). Marks an
        element that FHIR R4 requires but the note does not state; the element
        then carries this extension and no value.
      required:
        - url
        - valueCode
      properties:
        url:
          type: string
          enum:
            - http://hl7.org/fhir/StructureDefinition/data-absent-reason
          description: Identifies this extension as data-absent-reason.
        valueCode:
          type: string
          enum:
            - unknown
          description: Why the value is absent; always `unknown`.
    FhirRange:
      type: object
      description: >-
        A range between a low and a high quantity (FHIR R4 Range), e.g. an age
        range.
      properties:
        low:
          $ref: '#/components/schemas/FhirQuantity'
        high:
          $ref: '#/components/schemas/FhirQuantity'
    FhirFieldSubExtension:
      type: object
      description: >-
        The FHIR element that the sibling evidence or alternative blocks
        support, e.g. `code`, `bodySite`, or `onsetDateTime`.
      required:
        - url
        - valueString
      properties:
        url:
          type: string
          enum:
            - field
          description: Marks this sub-extension as the field name.
        valueString:
          type: string
          description: Name of the supported FHIR element.
          example: code
    FhirEvidenceSubExtension:
      type: object
      description: >-
        One evidence span from the clinical note. `start` and `end` are
        positions in the whole request note (see the endpoint description). For
        a `clinicalNote` context, a span inside one section also carries
        `sectionId`, `sectionStart` and `sectionEnd`; a span that crosses a
        section boundary does not.
      required:
        - url
        - extension
      properties:
        url:
          type: string
          enum:
            - evidence
          description: Marks this sub-extension as one evidence span.
        extension:
          type: array
          minItems: 2
          description: >-
            A `start` and an `end` sub-extension, optionally followed by a
            `text` sub-extension, then optionally `sectionId`, `sectionStart`
            and `sectionEnd`.
          items:
            anyOf:
              - $ref: '#/components/schemas/FhirEvidenceStartSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceEndSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceTextSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceSectionIdSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceSectionStartSubExtension'
              - $ref: '#/components/schemas/FhirEvidenceSectionEndSubExtension'
    FhirAlternativeSubExtension:
      type: object
      description: One competing code.
      required:
        - url
        - valueCodeableConcept
      properties:
        url:
          type: string
          enum:
            - alternative
          description: Marks this sub-extension as one competing code.
        valueCodeableConcept:
          $ref: '#/components/schemas/FhirCodeableConcept'
          description: The competing code.
    FhirEvidenceStartSubExtension:
      type: object
      description: Start of an evidence span.
      required:
        - url
        - valueInteger
      properties:
        url:
          type: string
          enum:
            - start
          description: Marks this sub-extension as the span start.
        valueInteger:
          type: integer
          description: >-
            Start of the span, inclusive: the number of characters of the
            request note before the first character of the span.
          example: 129
    FhirEvidenceEndSubExtension:
      type: object
      description: End of an evidence span.
      required:
        - url
        - valueInteger
      properties:
        url:
          type: string
          enum:
            - end
          description: Marks this sub-extension as the span end.
        valueInteger:
          type: integer
          description: >-
            End of the span, exclusive: the number of characters of the request
            note up to the first character after the span.
          example: 135
    FhirEvidenceTextSubExtension:
      type: object
      description: Verbatim text of an evidence span.
      required:
        - url
        - valueString
      properties:
        url:
          type: string
          enum:
            - text
          description: Marks this sub-extension as the span text.
        valueString:
          type: string
          description: The mentioning text as it appears in the note.
          example: asthma
    FhirEvidenceSectionIdSubExtension:
      type: object
      description: >-
        The request section an evidence span lies in. Only present when the
        request `context` is a `clinicalNote` and the span lies inside one
        section.
      required:
        - url
        - valueString
      properties:
        url:
          type: string
          enum:
            - sectionId
          description: Marks this sub-extension as the section id.
        valueString:
          type: string
          description: The `id` of the request section.
          example: vitals
    FhirEvidenceSectionStartSubExtension:
      type: object
      description: >-
        Start of an evidence span inside its section. Only present together with
        `sectionId`.
      required:
        - url
        - valueInteger
      properties:
        url:
          type: string
          enum:
            - sectionStart
          description: Marks this sub-extension as the section-relative span start.
        valueInteger:
          type: integer
          description: >-
            Start of the span, inclusive, counted in the section's `title`
            followed directly by its `body` (no separator).
          example: 6
    FhirEvidenceSectionEndSubExtension:
      type: object
      description: >-
        End of an evidence span inside its section. Only present together with
        `sectionId`.
      required:
        - url
        - valueInteger
      properties:
        url:
          type: string
          enum:
            - sectionEnd
          description: Marks this sub-extension as the section-relative span end.
        valueInteger:
          type: integer
          description: >-
            End of the span, exclusive, counted in the section's `title`
            followed directly by its `body` (no separator).
          example: 29
  headers:
    X-Corti-Retention-Policy:
      description: >
        Present and set to `acknowledged` if the request included
        `X-Corti-Retention-Policy: none`.
      schema:
        type: string
        enum:
          - acknowledged
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.