# Medications

> A medication catalog per organization, orders for a record with a dose, route, schedule and an as-needed maximum, orders imported from a pharmacy, planned doses, each dose recorded as given, refused, skipped or missed with a second check for high-risk medication, and a medication chart per record.

- Category: People
- Module: `medications`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/medications
- Page: https://bettersupabase.com/blocks/medications

## Install

```bash
npx better-supabase add medications
```

The command also installs `updated-at`, `memberships`, `permissions`, `subjects`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by medications; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    subjects: {},
    // Modes: "managed", "custom". The default is "managed".
    medications: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/medications`.

## Events

- `medication_administration.missed`
- `medication_administration.recorded`
- `medication_order.created`
- `medication_order.paused`
- `medication_order.stopped`
- `medication_order.updated`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md), [subjects](https://bettersupabase.com/blocks/subjects.md)

Works with: [notifications](https://bettersupabase.com/blocks/notifications.md), [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md)

## Recipes

- [Medication chart](https://bettersupabase.com/recipes/medication-chart.md): A record's medication orders for today, with the status of each planned dose.
