diff --git a/openapi.yaml b/openapi.yaml index 7badd14..1cdd5be 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -10891,6 +10891,108 @@ paths: "422": $ref: '#/components/responses/UnprocessableEntity' + /impact_frameworks/{id}/missing_metrics: + get: + tags: [Library] + summary: List an Impact Framework's metrics a Results Canvas can't show + operationId: listMissingFrameworkMetrics + description: | + When a project's or an album's Results Canvas is viewed through an Impact Framework (its **Metrics** + dropdown), it shows only the framework's metrics that are already used on the project. This lists + the rest: the framework's Activity and Attendance trackers (`Change`) and Outcomes (`Outcome`) that + aren't used on the project, or aren't used on one or more of the album's open projects. It is the + list the canvas's "metrics aren't shown" popup shows. + + Each metric names the projects without it, and `can_add` says whether you may add it there. Add a + metric with [Add metric to](#add-metric-to): `POST + /metrics/{change|outcome}/{metric_id}/destinations/projects/{project_id}`. + + Give `project_id` or `album_id`. The project must be one you can open, the album one you can view, + and the Impact Framework one the canvas's Metrics dropdown offers you (your organisation's or your + own). Anything else answers `404`. + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + description: The id of the Impact Framework (Template) + schema: + type: integer + example: 7174 + - name: project_id + in: query + description: The project whose Results Canvas to check + schema: + type: integer + example: 2210 + - name: album_id + in: query + description: The album (Bundle) whose Results Canvas to check, instead of a project + schema: + type: integer + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + responses: + "200": + description: The missing metrics, in the framework's column order + content: + application/json: + schema: + type: object + properties: + impact_framework: + type: object + properties: + id: { type: integer } + name: { type: string } + project_id: { type: integer, nullable: true } + album_id: { type: integer, nullable: true } + page: { type: integer } + page_size: { type: integer } + page_count: { type: integer } + total_count: { type: integer } + data: + type: array + items: + type: object + properties: + metric_type: { type: string, enum: [Change, Outcome] } + metric_id: { type: integer } + name: { type: string } + stage: { type: string, description: The Impact Scorecard column the framework puts it in } + stage_id: { type: integer } + projects: + type: array + description: The projects that don't use the metric yet + items: + type: object + properties: + id: { type: integer } + name: { type: string } + can_add: { type: boolean, description: Whether you may add the metric to this project } + example: + impact_framework: { id: 7174, name: Bambanani ECD Logic Model } + project_id: null + album_id: 381 + page: 1 + page_size: 1 + page_count: 1 + total_count: 1 + data: + - metric_type: Outcome + metric_id: 5521 + name: Improved school readiness + stage: Short-term outcomes + stage_id: 3 + projects: + - { id: 2210, name: Bambanani 2026, can_add: true } + "401": + $ref: '#/components/responses/Unauthorized' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /referral_submissions: post: tags: [Signup Pages] diff --git a/server.js b/server.js index 32a070a..c5ede18 100644 --- a/server.js +++ b/server.js @@ -2652,6 +2652,18 @@ function buildDocsPage() { { code: "404", cls: "response-4xx", desc: "No Impact Framework with that id that you may copy" }, { code: "422", cls: "response-4xx", desc: "The copy could not be saved; the error says why. Nothing is created" } ], "The same as Copy on the Manage Impact Frameworks page: the stages and metrics are copied, the projects are not.")} + ${endpointCard("GET", "/impact_frameworks/{id}/missing_metrics", "List an Impact Framework's metrics a Results Canvas can't show", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "The Impact Framework (Template): one the Results Canvas's Metrics dropdown offers you" }, + { name: "project_id", in: "query", type: "integer", required: false, desc: "The project whose Results Canvas to check (give this or album_id)" }, + { name: "album_id", in: "query", type: "integer", required: false, desc: "The album whose Results Canvas to check, instead of a project" }, + { name: "page", in: "query", type: "integer", required: false, desc: "Page number (default 1)" }, + { name: "per_page", in: "query", type: "integer", required: false, desc: "Metrics per page (default 10, max 200)" } + ], [ + { code: "200", cls: "response-2xx", desc: "data lists the framework's Activity and Attendance trackers (Change) and Outcomes not used on the project, or on some of the album's open projects, each with its stage and the projects without it (can_add says whether you may add it there)" }, + { code: "401", cls: "response-4xx", desc: "Missing or invalid token" }, + { code: "404", cls: "response-4xx", desc: "A project or album you can't see, or an Impact Framework its canvas doesn't offer you" }, + { code: "422", cls: "response-4xx", desc: "Neither project_id nor album_id was given" } + ], "The list behind the Results Canvas's \"metrics aren't shown\" popup. Add a metric with Add a metric to a destination (destination projects).")}