# Track a plan's progress across rounds

Source: https://developers.newjune.co/guides/plan-progress

> For each active plan, list its criterion and how each round's evaluation went, oldest first.

After every round, New June evaluates each active plan against that round. An evaluation's `status` is `open` (the criterion is not met yet), `partial`, or `complete`, with a `confidence` and a short `summary`. Lined up in order, a plan's evaluations show whether it is moving.

Remember that a plan graduates on its **criterion**, never on its steps. This script prints the criterion first, then the evaluations.

**Needs:** a key with `plans:read`, exported as `NEW_JUNE_API_KEY`.

curl:

```bash
#!/usr/bin/env bash
# plan-progress.sh: needs curl and jq.
set -euo pipefail

auth="Authorization: Bearer $NEW_JUNE_API_KEY"
plans=$(curl -sf "https://data.newjune.co/v1/plans?status=active&limit=100" -H "$auth")

echo "$plans" | jq -c '.data[]' | while read -r plan; do
  plan_id=$(echo "$plan" | jq -r '.id')
  echo "$plan" | jq -r '"\nPlan \(.id)\n  Done when: \(.criterion.threshold // "not set") (\(.criterion.measurable_signal // "no signal"))\n  Steps done: \([.steps[] | select(.status == "done")] | length) of \(.steps | length)"'

  curl -sf "https://data.newjune.co/v1/evaluations?plan_id=$plan_id&limit=100" -H "$auth" \
    | jq -r '.data | reverse | .[] | "  \(.evaluated_at[0:10])  \(.status)\t\(.confidence // "-")\t\(.summary // "")"'
done
```

TypeScript:

```ts
// plan-progress.mts: Node 20+, no dependencies. Run with: npx tsx plan-progress.mts
interface Plan {
  id: string;
  criterion: { measurable_signal: string | null; threshold: string | null } | null;
  steps: { title: string; status: 'open' | 'done' }[];
}
interface Evaluation {
  evaluated_at: string;
  status: 'open' | 'partial' | 'complete' | 'cancelled';
  confidence: 'high' | 'medium' | 'low' | null;
  summary: string | null;
}

async function* listAll<T>(path: string, params: Record<string, string> = {}) {
  let cursor: string | null = null;
  do {
    const url = new URL(`https://data.newjune.co/v1/${path}`);
    url.searchParams.set('limit', '100');
    for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value);
    if (cursor) url.searchParams.set('cursor', cursor);
    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` },
    });
    if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
    const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null };
    yield* page.data;
    cursor = page.has_more ? page.next_cursor : null;
  } while (cursor);
}

for await (const plan of listAll<Plan>('plans', { status: 'active' })) {
  const done = plan.steps.filter(step => step.status === 'done').length;
  console.log(`\nPlan ${plan.id}`);
  console.log(`  Done when: ${plan.criterion?.threshold ?? 'not set'} (${plan.criterion?.measurable_signal ?? 'no signal'})`);
  console.log(`  Steps done: ${done} of ${plan.steps.length}`);

  const evaluations: Evaluation[] = [];
  for await (const evaluation of listAll<Evaluation>('evaluations', { plan_id: plan.id })) {
    evaluations.push(evaluation);
  }
  for (const evaluation of evaluations.reverse()) {
    const day = evaluation.evaluated_at.slice(0, 10);
    console.log(`  ${day}  ${evaluation.status.padEnd(8)} ${(evaluation.confidence ?? '-').padEnd(6)} ${evaluation.summary ?? ''}`);
  }
}
```

Python:

```python
# plan_progress.py: needs requests (pip install requests).
import os
import requests

API = "https://data.newjune.co/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}"

def list_all(path, **params):
    params = {"limit": 100, **params}
    while True:
        response = session.get(f"{API}/{path}", params=params, timeout=30)
        response.raise_for_status()
        page = response.json()
        yield from page["data"]
        if not page["has_more"]:
            return
        params["cursor"] = page["next_cursor"]

for plan in list_all("plans", status="active"):
    criterion = plan["criterion"] or {}
    done = sum(1 for step in plan["steps"] if step["status"] == "done")
    print(f"\nPlan {plan['id']}")
    print(f"  Done when: {criterion.get('threshold') or 'not set'} ({criterion.get('measurable_signal') or 'no signal'})")
    print(f"  Steps done: {done} of {len(plan['steps'])}")

    evaluations = list(list_all("evaluations", plan_id=plan["id"]))
    for evaluation in reversed(evaluations):  # the API returns newest first
        day = evaluation["evaluated_at"][:10]
        confidence = evaluation["confidence"] or "-"
        print(f"  {day}  {evaluation['status']:<8} {confidence:<6} {evaluation['summary'] or ''}")
```

```text title="Example output"
Plan 6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d
  Done when: One or fewer in two straight rounds. (Three-putts per round from outside 30 feet.)
  Steps done: 2 of 3
  2026-06-01  open     high   Four three-putts from long range.
  2026-06-07  partial  medium Two three-putts from long range, down from four last round.
  2026-06-14  complete high   One three-putt, the second straight round at or under the threshold.
```

## Notes

- **Plan names** live on the priority. Fetch `GET /v1/priorities/<plan.priority_id>` and use its `title` for a readable heading.
- **Which round:** each evaluation has `round_id`. Fetch the round to show the course and score next to the status.
- **The current lineup:** `GET /v1/focus_sets/current` names the primary plan and up to two secondary plans you are working on now. It returns `404 no_current_focus_set` when there is none.
- **Graduated plans:** list them with `status=graduated`. `graduated_at` is when the criterion was met.
- **`cancelled` evaluations** appear only on older data. Skip them when charting.
