updated medicine schedules

This commit is contained in:
blaisadmin
2026-04-19 19:42:01 -04:00
parent 872b6c8663
commit d1657ef7ed
7 changed files with 363 additions and 66 deletions
+73 -2
View File
@@ -254,7 +254,19 @@ Role requirements are called out per endpoint below. If the signed-in member lac
"birdId": "uuid",
"name": "Meloxicam",
"dosage": "0.05 mL",
"frequency": "Every 12 hours",
"frequency": "twice_daily",
"doseSchedule": [
{
"key": "dose-1",
"label": "Morning",
"time": "08:00"
},
{
"key": "dose-2",
"label": "Evening",
"time": "20:00"
}
],
"route": "Oral",
"startDate": "2026-04-14",
"endDate": null,
@@ -262,6 +274,22 @@ Role requirements are called out per endpoint below. If the signed-in member lac
}
```
### Medication Administration
```json
{
"id": "uuid",
"medicationId": "uuid",
"birdId": "uuid",
"administeredOn": "2026-04-14",
"administrationSlot": "dose-1",
"status": "administered",
"notes": null,
"createdByUserId": "uuid",
"createdAt": "2026-04-14T12:34:56.000Z"
}
```
## Common Validation Rules
- Dates use `YYYY-MM-DD`
@@ -926,7 +954,19 @@ Request body:
{
"name": "Meloxicam",
"dosage": "0.05 mL",
"frequency": "Every 12 hours",
"frequency": "twice_daily",
"doseSchedule": [
{
"key": "dose-1",
"label": "Morning",
"time": "08:00"
},
{
"key": "dose-2",
"label": "Evening",
"time": "20:00"
}
],
"route": "Oral",
"startDate": "2026-04-14",
"endDate": "",
@@ -950,6 +990,37 @@ Requires auth with write access and role `owner`, `assistant`, or `caregiver`. U
Requires auth with write access and role `owner`, `assistant`, or `caregiver`. Deletes a medication record.
#### `GET /api/birds/:birdId/medication-administrations`
Requires auth. Lists medication administration events for a bird in the active workspace.
Response `200`:
```json
{
"administrations": []
}
```
#### `POST /api/birds/:birdId/medications/:medicationId/administrations`
Requires auth with write access and role `owner`, `assistant`, or `caregiver`. Upserts one scheduled medication event for a date and interval slot.
Request body:
```json
{
"administeredOn": "2026-04-14",
"administrationSlot": "dose-1",
"status": "administered",
"notes": ""
}
```
`status` is `administered` or `missed`. `administrationSlot` identifies the interval event for that day, such as `dose-1` or `dose-2`.
Medication `frequency` is one of `once_daily`, `twice_daily`, `every_8_hours`, `every_6_hours`, or `as_needed`. `doseSchedule` stores the editable labels and optional 24-hour `HH:MM` times used by administration slots.
Possible errors:
- `400` if `endDate` is before `startDate`