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

# Medication

> Medication actions, doses, and adverse events. 3 log types with payload schemas and examples.

Medication actions, doses, and adverse events. Submit these via `POST /v1/logs/batch` or the [Python SDK](/reference/sdk); see [How logs work](/send-data/how-logs-work) for submission fields and the difference between **lifecycle-tracked** and point-in-time log types.

## Medication adherence

**Type:** `medication_adherence` · **Source:** Python SDK / REST · **Extensible**

Reserved for recording dose outcomes (taken or skipped): medication\_adherence\[] with status (taken/skipped) per medication; rxnorm\_cui or medication\_name; scheduled\_time optional.

**Payload**

<ResponseField name="source" type="string | object">
  Who asserted this fact. Accepts a legacy string (e.g. 'patient\_self\_report') or a structured Source object.
</ResponseField>

<ResponseField name="medication_adherence" type="object[]" required>
  <Expandable title="fields">
    <ResponseField name="status" type="string" required>
      Whether the scheduled dose was taken or skipped.. One of: `taken`, `skipped`
    </ResponseField>

    <ResponseField name="rxnorm_cui" type="string">
      Preferred medication identifier (RXCUI). When provided, medication\_name is resolved server-side.
    </ResponseField>

    <ResponseField name="medication_name" type="string">
      Fallback name when rxnorm\_cui is not available.
    </ResponseField>

    <ResponseField name="scheduled_time" type="string">
      ISO 8601 UTC scheduled dose time. Enables timing deviation to be computed internally.
    </ResponseField>

    <ResponseField name="dose_amount" type="number">
      Actual amount taken if different from the prescribed dose.
    </ResponseField>

    <ResponseField name="dose_unit" type="string">
      Unit for dose\_amount (e.g. mg, ml).
    </ResponseField>

    <ResponseField name="extensions" type="object">
      Open key/value bag for client/source-specific fields that lack a typed slot; merged into the entry's extensions (leaf-level, last-writer-wins by event timestamp).
    </ResponseField>
  </Expandable>
</ResponseField>

**Example**

<CodeGroup>
  ```python Python theme={null}
  import olira
  from olira import OliraLogType

  olira.log(
      log_type=OliraLogType.MEDICATION_ADHERENCE,
      patient_id="your-patient-id",
      payload={
          "medication_adherence": [...]
      },
  )
  ```

  ```http HTTP theme={null}
  POST /v1/logs/batch
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json

  {
    "logs": [
      {
        "log_type": "medication_adherence",
        "patient_id": "8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
        "timestamp": "2026-03-18T09:00:00Z",
        "payload": {
          "medication_adherence": [...]
      }
      }
    ]
  }
  ```
</CodeGroup>

<Note>
  **Related types:** Use [`medication_list_update`](/reference/log-types/medication#medication-list-update) for adding, changing, or removing a medication from the list, [`medication_adverse_event`](/reference/log-types/medication#medication-adverse-event) for adverse reaction to a medication.
</Note>

## Medication list update

**Type:** `medication_list_update` · **Source:** Python SDK / REST, Integration · **Extensible**

Reserved for adding, updating, or removing medications from the patient's list: medications\[] with action (add/update/delete) per item; add/update carry dose, frequency, route, etc.; delete needs identifier only.

**Payload**

<ResponseField name="medications" type="object[]" required>
  <Expandable title="fields">
    <ResponseField name="action" type="string" required>
      add = new or currently prescribed/ongoing; update = change to existing regimen; delete = discontinue or remove.. One of: `add`, `update`, `delete`
    </ResponseField>

    <ResponseField name="medication_name" type="string">
      Generic or brand name. Fallback when rxnorm\_cui is not provided.
    </ResponseField>

    <ResponseField name="rxnorm_cui" type="string">
      Preferred identifier. When provided for add, medication\_name and therapeutic\_class are resolved server-side.
    </ResponseField>

    <ResponseField name="ndc_code" type="string">
      Package-level identifier. Used for pill-bottle scanning; not used for identity matching.
    </ResponseField>

    <ResponseField name="dose" type="string">
      Dose amount as a string (e.g. '10 mg', '500 mg').
    </ResponseField>

    <ResponseField name="dose_unit" type="string">
      Unit for dose (e.g. mg, ml).
    </ResponseField>

    <ResponseField name="frequency" type="string">
      Dosing frequency string (e.g. QD, BID, TID, once weekly).
    </ResponseField>

    <ResponseField name="route" type="string">
      Optional route of administration (e.g. oral, iv); empty string or omit when unknown.
    </ResponseField>

    <ResponseField name="form" type="string">
      Optional dosage form (e.g. tablet, capsule); empty string or omit when unknown.
    </ResponseField>

    <ResponseField name="therapeutic_class" type="string">
      Therapeutic class (e.g. ACE inhibitor, SSRI, beta-blocker). Resolved server-side when rxnorm\_cui is provided.
    </ResponseField>

    <ResponseField name="start_date" type="string">
      ISO 8601 date the medication was started or is scheduled to start.
    </ResponseField>

    <ResponseField name="schedule_times" type="string[]">
      Array of daily dose times (HH:MM). Required to activate adherence tracking for this medication.
    </ResponseField>

    <ResponseField name="adherence_window_minutes" type="integer">
      Minutes around scheduled\_time within which a dose is considered on-time. Default 60.
    </ResponseField>

    <ResponseField name="prescribed_by" type="object">
      <Expandable title="fields">
        <ResponseField name="name" type="string">
          Prescribing provider's name.
        </ResponseField>

        <ResponseField name="npi" type="string">
          Prescribing provider's NPI.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="extensions" type="object">
      Open key/value bag for client/source-specific fields that lack a typed slot; merged into the entry's extensions (leaf-level, last-writer-wins by event timestamp).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="source" type="string | object">
  Who asserted this fact. Accepts a legacy string (e.g. 'patient\_self\_report') or a structured Source object.
</ResponseField>

**Example**

<CodeGroup>
  ```python Python theme={null}
  import olira
  from olira import OliraLogType

  olira.log(
      log_type=OliraLogType.MEDICATION_LIST_UPDATE,
      patient_id="your-patient-id",
      payload={
          "medications": [...]
      },
  )
  ```

  ```http HTTP theme={null}
  POST /v1/logs/batch
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json

  {
    "logs": [
      {
        "log_type": "medication_list_update",
        "patient_id": "8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
        "timestamp": "2026-03-18T09:00:00Z",
        "payload": {
          "medications": [...]
      }
      }
    ]
  }
  ```
</CodeGroup>

<Note>
  **Related types:** Use [`medication_adherence`](/reference/log-types/medication#medication-adherence) for dose taken or skipped, [`medication_adverse_event`](/reference/log-types/medication#medication-adverse-event) for adverse event. Not intended for standing medication instructions in plan (clinical\_plan\_item is also wrong — use medication\_list\_update for regimen).
</Note>

## Medication adverse event

**Type:** `medication_adverse_event` · **Source:** Python SDK / REST, Integration · **Extensible**

Reserved for medication-related adverse events (side effects, reactions): events\[] with medication\_identifier and description (severity, onset\_date optional).

**Payload**

<ResponseField name="events" type="object[]" required>
  <Expandable title="fields">
    <ResponseField name="medication_identifier" type="string" required>
      RxNorm CUI or medication name of the causative medication.
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of the adverse event or side effect (e.g. nausea, neutropenia, hepatotoxicity).
    </ResponseField>

    <ResponseField name="severity" type="string">
      Severity of the adverse event.. Example: `mild`, `moderate`, `severe`
    </ResponseField>

    <ResponseField name="onset_date" type="string">
      ISO 8601 date when the adverse event began.
    </ResponseField>

    <ResponseField name="recorded_at" type="string">
      ISO 8601 UTC datetime when the event was recorded.
    </ResponseField>

    <ResponseField name="extensions" type="object">
      Open key/value bag for client/source-specific fields that lack a typed slot; merged into the entry's extensions (leaf-level, last-writer-wins by event timestamp).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="source" type="string | object">
  Who asserted this fact. Accepts a legacy string (e.g. 'patient\_self\_report') or a structured Source object.
</ResponseField>

**Example**

<CodeGroup>
  ```python Python theme={null}
  import olira
  from olira import OliraLogType

  olira.log(
      log_type=OliraLogType.MEDICATION_ADVERSE_EVENT,
      patient_id="your-patient-id",
      payload={
          "events": [...]
      },
  )
  ```

  ```http HTTP theme={null}
  POST /v1/logs/batch
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json

  {
    "logs": [
      {
        "log_type": "medication_adverse_event",
        "patient_id": "8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
        "timestamp": "2026-03-18T09:00:00Z",
        "payload": {
          "events": [...]
      }
      }
    ]
  }
  ```
</CodeGroup>

<Note>
  **Related types:** Use [`medication_adherence`](/reference/log-types/medication#medication-adherence) for dose taken/skipped, [`medication_list_update`](/reference/log-types/medication#medication-list-update) for add/change/stop medication.
</Note>
