A Requirement Set holds a funder's reporting requirements for a programme: one recipient (e.g. Comic Relief) and one or more albums and/or projects. Each Requirement is one thing the funder asks for, e.g. "KPI 3: number of young people completing the programme", linked to the metrics (trackers) that answer it. A Requirement with no metrics is Not covered.
+A metric is {type, id} with type Change, Indicator, CohortTracker, WorkflowTracker, FormulaTracker or FilteredMetric. answer_shape is one of count, sum, average, ratio, share_meeting_threshold, change_over_time, breakdown or quote.
id, name, recipient, source_name, source_url, reporting_cycle_id, project_ids, album_ids, requirements_count, covered_count and requirements (id, reference, wording, answer_shape, answer_format, answer_preset, recommended_source, word_limit, covered, metrics)" },
+ { code: "404", cls: "response-4xx", desc: "An organisation you can't see Report Templates in" },
+ { code: "422", cls: "response-4xx", desc: "No charity_id" }
+ ])}
+ ${endpointCard("GET", "/requirement_sets/{id}", "Get a Requirement Set", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "The Requirement Set" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The set as above, in data" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or one you can't see" }
+ ])}
+ ${endpointCard("POST", "/requirement_sets", "Create a Requirement Set", true, [
+ { name: "charity_id", in: "body", type: "integer", required: true, desc: "The organisation" },
+ { name: "name", in: "body", type: "string", required: true, desc: "e.g. Comic Relief 2027 grant" },
+ { name: "recipient", in: "body", type: "string", required: true, desc: "Who the requirements are for" },
+ { name: "source_name", in: "body", type: "string", required: false, desc: "The document they came from" },
+ { name: "source_url", in: "body", type: "string", required: false, desc: "Link to the original (http or https)" },
+ { name: "project_ids", in: "body", type: "array", required: false, desc: "Projects covered; with album_ids, at least one" },
+ { name: "album_ids", in: "body", type: "array", required: false, desc: "Albums covered" },
+ { name: "requirements", in: "body", type: "array", required: false, desc: "In order, each with reference, wording, answer_shape, answer_format, answer_preset, recommended_source, word_limit and metrics" }
+ ], [
+ { code: "201", cls: "response-2xx", desc: "The new set, in data" },
+ { code: "404", cls: "response-4xx", desc: "An organisation you can't create sets in" },
+ { code: "422", cls: "response-4xx", desc: "errors naming the requirement, e.g. KPI 2: Answer shape is not included in the list" }
+ ])}
+ ${endpointCard("PATCH", "/requirement_sets/{id}", "Change a Requirement Set", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "The Requirement Set" },
+ { name: "requirements", in: "body", type: "array", required: false, desc: "The full list in order: give an existing requirement's id to keep it; any left out are removed" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The changed set, in data" },
+ { code: "403", cls: "response-4xx", desc: "Not its creator or an Organisation Admin" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or one you can't see" },
+ { code: "422", cls: "response-4xx", desc: "errors" }
+ ], "Fields left out stay as they are. Giving project_ids or album_ids replaces the whole scope.")}
+ ${endpointCard("DELETE", "/requirement_sets/{id}", "Delete a Requirement Set", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "The Requirement Set" }
+ ], [
+ { code: "204", cls: "response-2xx", desc: "Deleted, with its requirements and links" },
+ { code: "403", cls: "response-4xx", desc: "Not its creator or an Organisation Admin" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or one you can't see" }
+ ])}
+ ${endpointCard("GET", "/reports/{report_id}/requirements", "Get the reporting requirements for a Report", true, [
+ { name: "report_id", in: "path", type: "integer", required: true, desc: "The Report" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "recipient, match (exact, narrowest, candidates or none), conflicting (two or more sets qualify equally; none is picked) and requirement_sets" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or a Report you can't see" }
+ ])}
+