---
title: "Medication data model"
url: "https://docs.unified.to/healthcare/medication/model"
description: "The Medication data model object in Unified's Medication API: 16 fields, including created_at, updated_at and patient_id, with types and enum values."
---
# Medication data model

 View field support, webhooks, and list parameters for each integration on the [Supported Integrations](https://docs.unified.to/healthcare/integrations.md) page. 

| Field                    | Type                                                                                                | Required | Description                                                                                                                       |
| ------------------------ | --------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| id                       | string                                                                                              | No       | Unique identifier for the medication order/prescription                                                                           |
| created\_at              | string (date-time)                                                                                  | No       | When the medication record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                                                   |
| updated\_at              | string (date-time)                                                                                  | No       | When the medication record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                                              |
| patient\_id              | string                                                                                              | No       | The patient the medication is for                                                                                                 |
| encounter\_id            | string                                                                                              | No       | The encounter in which the medication was ordered                                                                                 |
| practitioner\_id         | string                                                                                              | No       | The practitioner who prescribed the medication                                                                                    |
| name                     | string                                                                                              | No       | Human-readable name of the medication                                                                                             |
| codes                    | [HealthcareCode](https://docs.unified.to/healthcare/medication/model.md#HealthcareCode)\[\]         | No       | Codings for the medication (e.g. RxNorm)                                                                                          |
| codes\[\].system         | string                                                                                              | No       | The code system URI (e.g. http://loinc.org, http://snomed.info/sct)                                                               |
| codes\[\].code           | string                                                                                              | No       | The code within the system                                                                                                        |
| codes\[\].display        | string                                                                                              | No       | Human-readable display text for the code                                                                                          |
| status                   | enum                                                                                                | No       | Status of the medication order Values: DRAFT, ACTIVE, ON\_HOLD, COMPLETED, STOPPED, CANCELLED, ENTERED\_IN\_ERROR, UNKNOWN, OTHER |
| dosage                   | string                                                                                              | No       | Free-text dosage instructions (e.g. "1 tablet by mouth twice daily")                                                              |
| refill\_count            | number                                                                                              | No       | Number of refills authorized                                                                                                      |
| authored\_at             | string (date-time)                                                                                  | No       | When the medication was prescribed (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                                                       |
| start\_at                | string (date-time)                                                                                  | No       | When the patient should start taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                                      |
| end\_at                  | string (date-time)                                                                                  | No       | When the patient should stop taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                                       |
| notes                    | string                                                                                              | No       | Free-text notes about the medication                                                                                              |
| metadata                 | [HealthcareMetadata](https://docs.unified.to/healthcare/medication/model.md#HealthcareMetadata)\[\] | No       |                                                                                                                                   |
| metadata\[\].id          | string                                                                                              | No       |                                                                                                                                   |
| metadata\[\].value       | object                                                                                              | No       |                                                                                                                                   |
| metadata\[\].namespace   | string                                                                                              | No       |                                                                                                                                   |
| metadata\[\].format      | enum                                                                                                | No       | Values: TEXT, NUMBER, DATE, BOOLEAN, ARRAY, OBJECT                                                                                |
| metadata\[\].extra\_data | object                                                                                              | No       |                                                                                                                                   |
| metadata\[\].slug        | string                                                                                              | No       |                                                                                                                                   |

## TypeScript

```typescript
export type HealthcareMedication = {
	id?: string; // Unique identifier for the medication order/prescription
	created_at?: string-time; // When the medication record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	updated_at?: string-time; // When the medication record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	patient_id?: string; // The patient the medication is for
	encounter_id?: string; // The encounter in which the medication was ordered
	practitioner_id?: string; // The practitioner who prescribed the medication
	name?: string; // Human-readable name of the medication
	codes?: []; // Codings for the medication (e.g. RxNorm)
	status?: 'DRAFT' | 'ACTIVE' | 'ON_HOLD' | 'COMPLETED' | 'STOPPED' | 'CANCELLED' | 'ENTERED_IN_ERROR' | 'UNKNOWN' | 'OTHER'; // Status of the medication order
	dosage?: string; // Free-text dosage instructions (e.g. "1 tablet by mouth twice daily")
	refill_count?: number; // Number of refills authorized
	authored_at?: string-time; // When the medication was prescribed (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	start_at?: string-time; // When the patient should start taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	end_at?: string-time; // When the patient should stop taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	notes?: string; // Free-text notes about the medication
	metadata?: [];
	raw?: any; // Raw data from integration
} 
```

## Zod

```typescript
import { z } from 'zod';

export const ZodHealthcareMedication = z.object({
	id: z.string().optional().describe("Unique identifier for the medication order/prescription"),
	created_at: z.string-time().optional().describe("When the medication record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	updated_at: z.string-time().optional().describe("When the medication record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	patient_id: z.string().optional().describe("The patient the medication is for"),
	encounter_id: z.string().optional().describe("The encounter in which the medication was ordered"),
	practitioner_id: z.string().optional().describe("The practitioner who prescribed the medication"),
	name: z.string().optional().describe("Human-readable name of the medication"),
	codes: z.array().optional().describe("Codings for the medication (e.g. RxNorm)"),
	status: z.enum("DRAFT", "ACTIVE", "ON_HOLD", "COMPLETED", "STOPPED", "CANCELLED", "ENTERED_IN_ERROR", "UNKNOWN", "OTHER").optional().describe("Status of the medication order"),
	dosage: z.string().optional().describe("Free-text dosage instructions (e.g. "1 tablet by mouth twice daily")"),
	refill_count: z.number().optional().describe("Number of refills authorized"),
	authored_at: z.string-time().optional().describe("When the medication was prescribed (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	start_at: z.string-time().optional().describe("When the patient should start taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	end_at: z.string-time().optional().describe("When the patient should stop taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	notes: z.string().optional().describe("Free-text notes about the medication"),
	metadata: z.array().optional(),

});
```

## Python

```python
import dataclasses

@dataclasses.dataclass
class HealthcareMedicationStatus(str, Enum):
	DRAFT = 'DRAFT'
	ACTIVE = 'ACTIVE'
	ON_HOLD = 'ON_HOLD'
	COMPLETED = 'COMPLETED'
	STOPPED = 'STOPPED'
	CANCELLED = 'CANCELLED'
	ENTERED_IN_ERROR = 'ENTERED_IN_ERROR'
	UNKNOWN = 'UNKNOWN'
	OTHER = 'OTHER'

@dataclasses.dataclass
class HealthcareMedication:
	"""Unique identifier for the medication order/prescription"""
	id: Optional[str]
	"""When the medication record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	created_at: Optional[str]
	"""When the medication record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	updated_at: Optional[str]
	"""The patient the medication is for"""
	patient_id: Optional[str]
	"""The encounter in which the medication was ordered"""
	encounter_id: Optional[str]
	"""The practitioner who prescribed the medication"""
	practitioner_id: Optional[str]
	"""Human-readable name of the medication"""
	name: Optional[str]
	"""Codings for the medication (e.g. RxNorm)"""
	codes: Optional[PropertyHealthcareMedicationCodes]
	"""Status of the medication order"""
	status: Optional[HealthcareMedicationStatus]
	"""Free-text dosage instructions (e.g. "1 tablet by mouth twice daily")"""
	dosage: Optional[str]
	"""Number of refills authorized"""
	refill_count: Optional[int]
	"""When the medication was prescribed (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	authored_at: Optional[str]
	"""When the patient should start taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	start_at: Optional[str]
	"""When the patient should stop taking the medication (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	end_at: Optional[str]
	"""Free-text notes about the medication"""
	notes: Optional[str]
	metadata: Optional[PropertyHealthcareMedicationMetadata]

```
