# Data model

Source: https://developers.newjune.co/data-model

> How rounds, scores, shots, reports, priorities, plans, evaluations, focus sets, and clubs connect, and which id field links each pair.

Your data has two halves. The **round** half is what happened on the course: rounds, the score on each hole, and each shot. The **practice** half is what New June made of it: a report after each round, the priorities those reports point to, a plan for each priority, and an evaluation of each active plan after every round.

## The objects

| Object | What it is | Links |
| --- | --- | --- |
| [round](https://developers.newjune.co/api-reference/rounds) | One round of golf, scheduled, in progress, or finished. Carries totals (`total_strokes`, `par_total`, `score_to_par`), the course, and the tee. | The root. Other objects point to it with `round_id`. |
| [hole_score](https://developers.newjune.co/api-reference/hole-scores) | Your score on one hole: strokes, putts, penalties, fairway, green in regulation, par, and yardage. | `round_id` |
| [shot](https://developers.newjune.co/api-reference/shots) | One shot: club, lie, what you planned, what happened, and where it started and finished. | `round_id`, plus `hole_number` and `sequence_number` for its place in the round. `club` matches `club.club`. |
| [report](https://developers.newjune.co/api-reference/reports) | The analysis of one round: a headline, the written analysis, per-hole notes, and the areas to work on. One per round. | `round_id` |
| [priority](https://developers.newjune.co/api-reference/priorities) | A lasting area of your game that reports keep pointing to, such as lag putting. | `first_seen_report_id`, `last_seen_report_id` |
| [plan](https://developers.newjune.co/api-reference/plans) | A practice plan for one priority, with ordered **steps** and one graduation **criterion**. | `priority_id`, `created_from_report_id` |
| [evaluation](https://developers.newjune.co/api-reference/evaluations) | How one plan went in one round: `open`, `partial`, or `complete`, with a `confidence`. | `plan_id`, `round_id`, `report_id` |
| [focus_set](https://developers.newjune.co/api-reference/focus-sets) | The lineup of plans in use for a period: one primary plan and up to two secondary plans. | `primary_plan_id`, `secondary_plan_ids`, `source_report_id` |
| [club](https://developers.newjune.co/api-reference/clubs) | A club in your bag, with your typical carry and total distance. | Matched to shots by the `club` value, not by id. |

## How the practice loop works

1. You play a **round**. Hole scores and shots are recorded against it.
2. After the round, New June produces a **report**. Its `priorities` list names the areas to work on, most important first.
3. Areas that keep coming up become durable **priorities**. `first_seen_report_id` and `last_seen_report_id` show when a priority first appeared and when a report last raised it.
4. A priority gets a **plan**: practice **steps** (milestones such as a drill) and one **criterion** (what counts as done, measured from your rounds).
5. After every later round, New June writes an **evaluation** for each active plan. `status` says how far the plan got in that round: `open` (not met yet), `partial`, or `complete`.
6. The **focus set** names the plans you are working on right now. `GET /v1/focus_sets/current` returns it.

> **Steps never graduate a plan.** Marking every step done does not finish a plan. Only the criterion does: a plan becomes `graduated` when your rounds meet its criterion, as recorded in its evaluations. Steps are milestones on the way.

## Finding related objects

Relationships are query filters, never nested paths. To go from one object to its related objects, filter the related collection by the id:

| You have | You want | Request |
| --- | --- | --- |
| A round | Its hole scores | `GET /v1/hole_scores?round_id=<round.id>` |
| A round | Its shots, in playing order | `GET /v1/shots?round_id=<round.id>` |
| A round | Its report | `GET /v1/reports?round_id=<round.id>` |
| A round | The evaluations made after it | `GET /v1/evaluations?round_id=<round.id>` |
| A priority | Its plans | `GET /v1/plans?priority_id=<priority.id>` |
| A plan | Its evaluations, newest first | `GET /v1/evaluations?plan_id=<plan.id>` |
| A plan | Its priority | `GET /v1/priorities/<plan.priority_id>` |
| A focus set | Its plans | `GET /v1/plans/<id>` for `primary_plan_id` and each of `secondary_plan_ids` |

There is no `expand` parameter. Fetch related objects with a second request, and cache what you can: priorities, plans, and clubs change far less often than rounds.

## Ids

Every object has an `id` (a UUID) and an `object` field naming its type. Ids are stable: an object keeps its id for its whole life. A field that names another object ends in `_id` and holds that object's `id`. The round's id is always called `round_id`.
