From 505c2d6b3fa8ee5b78cac810c0338bb3f4960415 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 09:40:13 +0000 Subject: [PATCH 1/2] Document automatic_outcome on Create a Survey (CP-8352) POST /api/v2/surveys takes automatic_outcome (default true); a new_metric may leave out outcome_id to go under the Survey's own Outcome, and the response gives automatic_outcome_id. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xqXfFBo8txwkjb3t5s --- openapi.yaml | 15 ++++++++++++++- server.js | 5 +++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 0dd61ad..be586f8 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13631,6 +13631,14 @@ paths: Metric needs `list_id` (an existing List) or `list` (a new List with its choices). - `new_field`: a new Field; `section_title` makes a heading. + **The Survey's own Outcome.** Unless you send `automatic_outcome: false`, the Survey gets an + Outcome named after it, as the Create a survey page makes it (numbered if your organisation + already has an Outcome with that name, e.g. "Feedback Questionnaire (2)"). A `new_metric` + that leaves out `outcome_id` goes under that Outcome. The response gives its id as + `automatic_outcome_id`. With `automatic_outcome: false`, every `new_metric` needs `outcome_id`. + Questions added later with Change a Survey's questions may leave out `outcome_id` too, while + the Survey still has that Outcome. + Search the library first and reuse what fits: results recorded against a copy of a Metric don't add up with the original. If a new Metric, List or Field has the same or a near-identical name to one you could reuse, nothing is created and you get `409` with the @@ -13696,6 +13704,10 @@ paths: type: string intro_message: type: string + automatic_outcome: + type: boolean + default: true + description: Group the questions under one Outcome named after the Survey. With false, every new_metric needs outcome_id departments: type: array items: {type: string} @@ -25136,7 +25148,7 @@ components: type: integer new_metric: type: object - required: [name, metric_type, default_question, outcome_id] + required: [name, metric_type, default_question] properties: name: type: string @@ -25161,6 +25173,7 @@ components: items: {type: string} outcome_id: type: integer + description: The Outcome it measures. Leave it out to use the Survey's own Outcome (automatic_outcome) unit_id: type: integer description: Value only diff --git a/server.js b/server.js index d988877..b3740a7 100644 --- a/server.js +++ b/server.js @@ -2843,7 +2843,7 @@ function buildDocsPage() { ${endpointCard("POST", "/surveys", "Create a Survey with its questions", true, [ { name: "organisation_id", in: "body", type: "integer", required: true, desc: "The organisation (Charity) that will own it; you must be one of its editors" }, { name: "name", in: "body", type: "string", required: true, desc: "The Survey's name" }, - { name: "questions", in: "body", type: "array", required: true, desc: "In order, at most 50. Each has exactly one of metric_id, field_id, activity_tracker_id (reuse), new_metric {name, metric_type, default_question, outcome_id, list_id or list {name, choices}, unit_id} or new_field {field_name, field_data_type}; plus optional is_mandatory, choice, external_description, and, with intervals, by_interval and only_in_intervals" }, + { name: "questions", in: "body", type: "array", required: true, desc: "In order, at most 50. Each has exactly one of metric_id, field_id, activity_tracker_id (reuse), new_metric {name, metric_type, default_question, outcome_id (optional while automatic_outcome is on), list_id or list {name, choices}, unit_id} or new_field {field_name, field_data_type}; plus optional is_mandatory, choice, external_description, and, with intervals, by_interval and only_in_intervals" }, { name: "intervals", in: "body", type: "array", required: false, desc: "The Survey's Shared Intervals in order, at most 10, e.g. [\"Baseline\", \"Endpoint\"], for a Survey answered more than once. Projects it is added to later use them" }, { name: "questions[].by_interval", in: "body", type: "array", required: false, desc: "Adjust When: entries {interval, respondent, question} reword the question, {interval, respondent, hide: true} hide it. Leave out interval for every Interval and respondent (participant, colleague, observer, public) for everyone; where two cover the same place, the one naming more wins" }, { name: "questions[].only_in_intervals", in: "body", type: "array", required: false, desc: "Show the question only in these Intervals, e.g. [\"Endpoint\"]" }, @@ -2852,11 +2852,12 @@ function buildDocsPage() { { name: "scoring", in: "body", type: "object", required: false, desc: "Scoring and Verdicts: {questions, verdicts: [{name, from, to, description}]} adds up those questions' points into bands. Give new scale Metrics points per answer (new_metric.points); a reused Metric can be scored only if it already has points. Bands must cover every possible total with no gaps" }, { name: "question_grids", in: "body", type: "array", required: false, desc: "Question Grids: [{outcome_id, questions}] shows scale questions that measure the Outcome first and share one List as one table, headed by the Outcome's title. List every scale question of that Outcome; grid questions can't have display_if or skip_to" }, { name: "description / intro_message", in: "body", type: "string", required: false, desc: "Shown with the Survey" }, + { name: "automatic_outcome", in: "body", type: "boolean", required: false, desc: "Default true: the Survey gets its own Outcome named after it (numbered if the name is taken, e.g. \"Feedback Questionnaire (2)\"), and a new_metric without outcome_id goes under it. false: every new_metric needs outcome_id" }, { name: "departments / causes / sub_causes", in: "body", type: "array", required: false, desc: "Names, for the Explore filters" }, { name: "approved", in: "body", type: "boolean", required: false, desc: "Makerble staff only: show it to every organisation and approve its new Metrics and Lists" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create new items even though near-identical ones exist (see 409)" } ], [ - { code: "201", cls: "response-2xx", desc: "Created: data is the Survey as Get a library item shows it, with its intervals and questions in order (each with any by_interval wording), plus approved" }, + { code: "201", cls: "response-2xx", desc: "Created: data is the Survey as Get a library item shows it, with automatic_outcome and automatic_outcome_id, its intervals and questions in order (each with any by_interval wording), plus approved" }, { code: "401", cls: "response-4xx", desc: "Missing or invalid token" }, { code: "403", cls: "response-4xx", desc: "You may not create Surveys, as in the Makerble app" }, { code: "404", cls: "response-4xx", desc: "The organisation, or an id in a question, isn't one you can use; the error names the question" }, From 18cb2f06529ddff1c0e5f0bc06beaec246cbcd4b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 11:36:23 +0000 Subject: [PATCH 2/2] Describe the Survey's outcome as made only when needed (CP-8352) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xqXfFBo8txwkjb3t5s --- openapi.yaml | 18 +++++++++--------- server.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index be586f8..4b1717a 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13631,13 +13631,13 @@ paths: Metric needs `list_id` (an existing List) or `list` (a new List with its choices). - `new_field`: a new Field; `section_title` makes a heading. - **The Survey's own Outcome.** Unless you send `automatic_outcome: false`, the Survey gets an - Outcome named after it, as the Create a survey page makes it (numbered if your organisation - already has an Outcome with that name, e.g. "Feedback Questionnaire (2)"). A `new_metric` - that leaves out `outcome_id` goes under that Outcome. The response gives its id as - `automatic_outcome_id`. With `automatic_outcome: false`, every `new_metric` needs `outcome_id`. - Questions added later with Change a Survey's questions may leave out `outcome_id` too, while - the Survey still has that Outcome. + **The Survey's own Outcome.** Give each `new_metric` the `outcome_id` of an existing Outcome + when one fits. A `new_metric` that leaves out `outcome_id` goes under an Outcome named after + the Survey, made only when a question needs it and shared by every such question (numbered if + your organisation already has an Outcome with that name, e.g. "Feedback Questionnaire (2)"). + The response gives its id as `automatic_outcome_id`, or null when none was needed. With + `automatic_outcome: false`, every `new_metric` needs `outcome_id`. Questions added later with + Change a Survey's questions may leave out `outcome_id` too, while the Survey has that Outcome. Search the library first and reuse what fits: results recorded against a copy of a Metric don't add up with the original. If a new Metric, List or Field has the same or a @@ -13707,7 +13707,7 @@ paths: automatic_outcome: type: boolean default: true - description: Group the questions under one Outcome named after the Survey. With false, every new_metric needs outcome_id + description: A new_metric without outcome_id goes under an Outcome named after the Survey, made only if needed. With false, every new_metric needs outcome_id departments: type: array items: {type: string} @@ -25173,7 +25173,7 @@ components: items: {type: string} outcome_id: type: integer - description: The Outcome it measures. Leave it out to use the Survey's own Outcome (automatic_outcome) + description: The Outcome it measures. Leave it out to use an Outcome named after the Survey, made if needed (automatic_outcome) unit_id: type: integer description: Value only diff --git a/server.js b/server.js index b3740a7..68b69f1 100644 --- a/server.js +++ b/server.js @@ -2852,7 +2852,7 @@ function buildDocsPage() { { name: "scoring", in: "body", type: "object", required: false, desc: "Scoring and Verdicts: {questions, verdicts: [{name, from, to, description}]} adds up those questions' points into bands. Give new scale Metrics points per answer (new_metric.points); a reused Metric can be scored only if it already has points. Bands must cover every possible total with no gaps" }, { name: "question_grids", in: "body", type: "array", required: false, desc: "Question Grids: [{outcome_id, questions}] shows scale questions that measure the Outcome first and share one List as one table, headed by the Outcome's title. List every scale question of that Outcome; grid questions can't have display_if or skip_to" }, { name: "description / intro_message", in: "body", type: "string", required: false, desc: "Shown with the Survey" }, - { name: "automatic_outcome", in: "body", type: "boolean", required: false, desc: "Default true: the Survey gets its own Outcome named after it (numbered if the name is taken, e.g. \"Feedback Questionnaire (2)\"), and a new_metric without outcome_id goes under it. false: every new_metric needs outcome_id" }, + { name: "automatic_outcome", in: "body", type: "boolean", required: false, desc: "Default true: a new_metric without outcome_id goes under an Outcome named after the Survey, made only when a question needs it (numbered if the name is taken, e.g. \"Feedback Questionnaire (2)\"). false: every new_metric needs outcome_id" }, { name: "departments / causes / sub_causes", in: "body", type: "array", required: false, desc: "Names, for the Explore filters" }, { name: "approved", in: "body", type: "boolean", required: false, desc: "Makerble staff only: show it to every organisation and approve its new Metrics and Lists" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create new items even though near-identical ones exist (see 409)" }