From 997231e8a0f434c3f008b41ee5f220f6123de3bb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 19:58:36 +0000 Subject: [PATCH] Document Distance Travelled Survey and date limits CP-9245 (MakerbleDev/makerble#17909) adds two optional keys to a Cohort Tracker's distance_travelled criteria: story_category_ids, to compare only answers given in those Surveys, and responses_between ('dd/mm/yyyy - dd/mm/yyyy'), to compare only answers dated in a range. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xph3GkeT23TJJAtjde --- openapi.yaml | 2 +- server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 93db327..7648540 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13517,7 +13517,7 @@ paths: - `project_story_category_ids` (Survey Campaigns completed) with `project_story_category_filter_data: {id: {story_date_from}}` - `attendance_rate`: `{change_id, from, to, event_scope}` - `same_day_rate` (Same-day rate): `{change_id, event_scope, event_filter_params, qualifying_change_ids, match: all|any, qualifying_event_scope, qualifying_event_filter_params, from, to}`. On the days the `change_id` Engagement Tracker was recorded for a Contact at an event, the percentage of those days on which the `qualifying_change_ids` Engagement Trackers (all of them, or any one) were also recorded for them at an event on the same date, in the Organisation's time zone. A day with no matching record counts as not met; Contacts with no such days never match. E.g. children who received all four meals on every day they attended class: `from: "100", to: "100"` - - `distance_travelled`: `{trackers: [{indicator_id, directions: [improved|no_change|worsened|reached_top]}], match: any|all|at_least, match_count, same_project}`. Compares each Contact's first and latest answer to each Choice Tracker; `reached_top` means the latest answer is the best on the scale, whatever the first was. `match` says how many of the trackers a Contact must meet: `any` (default), `all`, or `at_least` `match_count` of them. E.g. Contacts who improved or reached the top answer in at least 2 of 3 goals: three trackers with `directions: [improved, reached_top]`, `match: at_least`, `match_count: 2`. With `denominator: enough_data`, a percentage is out of the Contacts with two responses on that many trackers + - `distance_travelled`: `{trackers: [{indicator_id, directions: [improved|no_change|worsened|reached_top]}], match: any|all|at_least, match_count, same_project, story_category_ids, responses_between}`. Compares each Contact's first and latest answer to each Choice Tracker; `reached_top` means the latest answer is the best on the scale, whatever the first was. `match` says how many of the trackers a Contact must meet: `any` (default), `all`, or `at_least` `match_count` of them. E.g. Contacts who improved or reached the top answer in at least 2 of 3 goals: three trackers with `directions: [improved, reached_top]`, `match: at_least`, `match_count: 2`. With `denominator: enough_data`, a percentage is out of the Contacts with two responses on that many trackers. Optional `story_category_ids` (Survey ids) compares only answers given in those Surveys, e.g. when teachers and parents fill in different versions of the same survey; empty or omitted uses answers from any Survey. Optional `responses_between` (`dd/mm/yyyy - dd/mm/yyyy`, either end may be blank) compares only answers dated in that range; in a Cohort Tracker it narrows the reporting period further - `indicator_comparisons`: `{indicator_id: {response: any|latest, op, sub_ratio_ids, values}}` - `indicator_sub_ratios_hash`: `{indicator_id: [sub_ratio_id]}` diff --git a/server.js b/server.js index eee2d74..878bc39 100644 --- a/server.js +++ b/server.js @@ -3340,7 +3340,7 @@ function buildDocsPage() { ${endpointCard("POST", "/cohort_trackers/preview", "Preview Cohort Tracker criteria", true, [], [ { code: "200", cls: "response-2xx", desc: "count of matching Contacts and the normalised criteria" }, { code: "422", cls: "response-4xx", desc: "An unknown membership" } - ], "Body: charity_id, cohort_tracker: {criteria, membership}. criteria takes any key the Contacts page's Filters sidebar sends. project_ids, bundle_ids, narrow_bundle_ids, projects_states_hash, project_beneficiary_states, project_story_category_ids, attendance_rate, same_day_rate (Same-day rate), distance_travelled (Distance Travelled Direction; match: any|all|at_least with match_count sets how many of its Choice Trackers a Contact must meet, e.g. improved in at least 2 of 3 goals, and the reached_top direction matches a latest answer that is the best on the scale), indicator_comparisons and indicator_sub_ratios_hash follow the Project or Album and the reporting period; the other sections (e.g. group_ids, age_from) apply to the Contacts' current details. Keys no filter reads are dropped.")} + ], "Body: charity_id, cohort_tracker: {criteria, membership}. criteria takes any key the Contacts page's Filters sidebar sends. project_ids, bundle_ids, narrow_bundle_ids, projects_states_hash, project_beneficiary_states, project_story_category_ids, attendance_rate, same_day_rate (Same-day rate), distance_travelled (Distance Travelled Direction; match: any|all|at_least with match_count sets how many of its Choice Trackers a Contact must meet, e.g. improved in at least 2 of 3 goals, and the reached_top direction matches a latest answer that is the best on the scale; optional story_category_ids compares only answers from those Surveys and responses_between (dd/mm/yyyy - dd/mm/yyyy) only answers dated in that range), indicator_comparisons and indicator_sub_ratios_hash follow the Project or Album and the reporting period; the other sections (e.g. group_ids, age_from) apply to the Contacts' current details. Keys no filter reads are dropped.")} ${endpointCard("POST", "/cohort_trackers", "Create a Cohort Tracker", true, [], [ { code: "201", cls: "response-2xx", desc: "Cohort Tracker created" }, { code: "403", cls: "response-4xx", desc: "Not an editor or reporter of the Organisation" },