---
title: "Get a patient's Mediterranean diet score"
method: GET
path: "/partner/patients/{patient_id}/mediterranean-diet-scores"
tags: ["partner"]
---

# Get a patient's Mediterranean diet score

`GET /partner/patients/{patient_id}/mediterranean-diet-scores`

## Request

- Base URL: `https://api.rxfoodapp.com/api`
- URL: `https://api.rxfoodapp.com/api/partner/patients/{patient_id}/mediterranean-diet-scores`
- Auth: API key in header `X-Api-Key`

Returns `current` -- the one score to display on a dashboard -- plus `scores`, the history behind it.

Every score covers a trailing 7-day window ending on its `date`. It is a single score computed from that whole week of food, not an average of daily scores.

`current.score` is populated only when `current.status` is `ok`; any other status means there is no reliable number to show and says why, so check it before rendering. `score_percent` is the safest field to display, being already normalized against `max_score`. The scoring version is determined by the patient's clinic configuration and is neither selectable nor exposed, so read `max_score` from the response rather than hard-coding it.

`current` is the patient's most recent usable score regardless of the requested range, falling back through up to 30 days so a short gap in logging does not blank the dashboard. It is brought up to date when you call this endpoint, while historical entries are recomputed nightly.

## Path parameters

- `patient_id` integer, required

## Query parameters

- `date_since` string, date
- `date_until` string, date

## Response `200`

Daily Mediterranean diet scores for the requested range

- PartnerApiMediterraneanDietScoreSeries
  - `current` PartnerApiMediterraneanDietScoreCurrent, required: The single score to show on a dashboard. Always the patient's most recent usable score, and never today: windows end yesterday or earlier, so the number is stable for the whole day rather than drifting as meals are logged. If the patient has not logged enough recently, this falls back through up to 30 days to their last usable score -- so a few days off does not blank the dashboard. Compare `date` against today to see how current it is. When nothing in that lookback is usable, `score` is null and `status` explains why. Independent of date_since/date_until, and brought up to date when you call this endpoint, so it may be newer than the matching entry in `scores`.
    - `date` string, date, required: The day this score is reported for. The score covers the window_days days ending on it, inclusive.
    - `qualifying_days` integer, required: Days in the window on which the patient logged at least 500 kcal across at least 2 meals. Three are needed for a score. Use it to show progress when status is `insufficient_meals`, e.g. "2 of 3 days logged".
    - `score` number, nullable, required: Mediterranean diet score, from 0 to max_score. Populated only when status is `ok`, so an unreliable number can never be displayed by accident.
    - `score_percent` number, nullable, required: score as a percentage of max_score, 0-100, to one decimal. Null whenever score is null. The safest field to display: it needs no knowledge of the scoring scale.
    - `status` string, required: Whether there is a score to show, and if not, why. Treat this list as open-ended: handle unrecognized values as "no score to show". Current values: `ok` - score is present and reliable; `no_meals` - the patient has logged no meals at all since joining; prompt them to start logging; `insufficient_meals` - fewer than 3 qualifying days; prompt them to log a few more; `not_yet_computed` - enough meals were logged, but the score is not calculated yet; retry later. Do not treat this as a closed enum — new values may be added.
  - `max_score` number, required: Highest attainable score. Depends on the scoring version configured for the patient's clinic, which is not exposed and may change, so read it here rather than hard-coding it.
  - `patient_id` integer, required
  - `scores` PartnerApiMediterraneanDietScorePoint[], required: History, one entry per calendar day from date_since to date_until, ascending. Recomputed nightly, so the most recent entries can lag `current`.
    - `date` string, date, required: The day this score is reported for. The score covers the window_days days ending on it, inclusive.
    - `score` number, nullable, required: Mediterranean diet score for the window, from 0 to max_score. Null when the patient did not log enough that week to be scored. A returned 0 is a real score.
  - `window_days` integer, required: Length of every scoring window in days. Each score covers the window_days days ending on its date.

## Other responses

- `400`: Invalid date format or range
- `401`: Invalid or missing API key
- `403`: Partner does not have access to this patient
- `404`: Patient not found

---

[API](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server.md) - [All operations](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/llms.txt) - [OpenAPI document](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/revisions/c3d8e22b22e8?raw)
