Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.** 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
near-identical name to one you could reuse, nothing is created and you get `409` with the
Expand Down Expand Up @@ -13696,6 +13704,10 @@ paths:
type: string
intro_message:
type: string
automatic_outcome:
type: boolean
default: true
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}
Expand Down Expand Up @@ -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
Expand All @@ -25161,6 +25173,7 @@ components:
items: {type: string}
outcome_id:
type: integer
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
Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>metric_id</code>, <code>field_id</code>, <code>activity_tracker_id</code> (reuse), <code>new_metric</code> {name, metric_type, default_question, outcome_id, list_id or list {name, choices}, unit_id} or <code>new_field</code> {field_name, field_data_type}; plus optional <code>is_mandatory</code>, <code>choice</code>, <code>external_description</code>, and, with <code>intervals</code>, <code>by_interval</code> and <code>only_in_intervals</code>" },
{ name: "questions", in: "body", type: "array", required: true, desc: "In order, at most 50. Each has exactly one of <code>metric_id</code>, <code>field_id</code>, <code>activity_tracker_id</code> (reuse), <code>new_metric</code> {name, metric_type, default_question, outcome_id (optional while <code>automatic_outcome</code> is on), list_id or list {name, choices}, unit_id} or <code>new_field</code> {field_name, field_data_type}; plus optional <code>is_mandatory</code>, <code>choice</code>, <code>external_description</code>, and, with <code>intervals</code>, <code>by_interval</code> and <code>only_in_intervals</code>" },
{ name: "intervals", in: "body", type: "array", required: false, desc: "The Survey's Shared Intervals in order, at most 10, e.g. <code>[\"Baseline\", \"Endpoint\"]</code>, 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 <code>{interval, respondent, question}</code> reword the question, <code>{interval, respondent, hide: true}</code> hide it. Leave out <code>interval</code> for every Interval and <code>respondent</code> (<code>participant</code>, <code>colleague</code>, <code>observer</code>, <code>public</code>) 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. <code>[\"Endpoint\"]</code>" },
Expand All @@ -2852,11 +2852,12 @@ function buildDocsPage() {
{ name: "scoring", in: "body", type: "object", required: false, desc: "Scoring and Verdicts: <code>{questions, verdicts: [{name, from, to, description}]}</code> adds up those questions' points into bands. Give new scale Metrics <code>points</code> per answer (<code>new_metric.points</code>); 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: <code>[{outcome_id, questions}]</code> 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 <code>display_if</code> or <code>skip_to</code>" },
{ 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 <code>true</code>: a <code>new_metric</code> without <code>outcome_id</code> 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)\"). <code>false</code>: every <code>new_metric</code> needs <code>outcome_id</code>" },
{ 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: "<code>true</code> to create new items even though near-identical ones exist (see 409)" }
], [
{ code: "201", cls: "response-2xx", desc: "Created: <code>data</code> is the Survey as Get a library item shows it, with its <code>intervals</code> and questions in order (each with any <code>by_interval</code> wording), plus <code>approved</code>" },
{ code: "201", cls: "response-2xx", desc: "Created: <code>data</code> is the Survey as Get a library item shows it, with <code>automatic_outcome</code> and <code>automatic_outcome_id</code>, its <code>intervals</code> and questions in order (each with any <code>by_interval</code> wording), plus <code>approved</code>" },
{ 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" },
Expand Down
Loading