Skip to content
Closed
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
17 changes: 17 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10114,6 +10114,21 @@ components:
type: integer
nullable: true
description: "Cases sources only: count only the Cases created with this one of the Organisation's Case Forms"
contact_criteria:
$ref: '#/components/schemas/WorkflowTrackerContactCriteria'

WorkflowTrackerContactCriteria:
type: object
description: >-
"Only count contacts who match": Contact Filters criteria, in the same shape as a Cohort Tracker's criteria
and a Saved Filter's, that a Contact must meet for their items to count. Matched on each Contact's current
details, so editing a Contact can change past results. {} counts every Contact. Keys a Contacts filter
doesn't read, and blank values, are dropped.
additionalProperties: true
example:
age_to:
year: "17"
beneficiary_types: ["3"]

WorkflowTracker:
type: object
Expand Down Expand Up @@ -10146,6 +10161,8 @@ components:
example:
destinations: "except"
project_ids: [4512]
contact_criteria:
$ref: '#/components/schemas/WorkflowTrackerContactCriteria'
created_at:
type: string
format: date-time
Expand Down
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@ function buildDocsPage() {
<div class="section-eyebrow">Impact framework</div>
<h2 class="section-title">Workflow Trackers</h2>
<div class="section-desc">
<p>A Workflow Tracker is a metric that counts records Makerble's own features create, rather than Contacts tagged in updates. Its <code>source</code> says what it counts: <code>signpostings</code> (Signpostings made from the Project, counted once whether they name the Organisation signposted to, the Person, or both; signpostings saved without a Project aren't counted anywhere), <code>internal_referrals</code> (Contacts in the Project who are added to another of the Organisation's Projects, dated by the Status in Projects history), <code>cases_created</code> (Cases created on the Project), <code>cases_closed</code> (each time one of those Cases is closed) or <code>cases_open</code> (the Cases open at the end of each timeframe; always a snapshot). <code>count_mode</code> is <code>items</code> (each signposting, referral, Case or closing; adds up across periods, except <code>cases_open</code>) or <code>contacts</code> (each Contact once; a snapshot). Confidential Cases are counted, but only listed to people who can see them. It is placed in an Impact Scorecard column like other metrics.</p>
<p>A Workflow Tracker is a metric that counts records Makerble's own features create, rather than Contacts tagged in updates. Its <code>source</code> says what it counts: <code>signpostings</code> (Signpostings made from the Project, counted once whether they name the Organisation signposted to, the Person, or both; signpostings saved without a Project aren't counted anywhere), <code>internal_referrals</code> (Contacts in the Project who are added to another of the Organisation's Projects, dated by the Status in Projects history), <code>cases_created</code> (Cases created on the Project), <code>cases_closed</code> (each time one of those Cases is closed) or <code>cases_open</code> (the Cases open at the end of each timeframe; always a snapshot). <code>count_mode</code> is <code>items</code> (each signposting, referral, Case or closing; adds up across periods, except <code>cases_open</code>) or <code>contacts</code> (each Contact once; a snapshot). Confidential Cases are counted, but only listed to people who can see them. It is placed in an Impact Scorecard column like other metrics. Set <code>contact_criteria</code> (\"Only count contacts who match\") to count only the items of Contacts who meet Contact Filters criteria, in the same shape as a Cohort Tracker's <code>criteria</code>; they are matched on each Contact's current details, so editing a Contact can change past results.</p>
</div>
<div class="callout callout-tip">
<span class="callout-icon">✓</span>
Expand All @@ -2116,12 +2116,12 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "<code>results: {period, year_to_date, all_time}</code> on the Project, and the latest <code>records</code> counted that the user may see, with <code>hidden_count</code> for the rest" },
{ code: "404", cls: "response-4xx", desc: "The Project isn't the Organisation's" },
{ code: "422", cls: "response-4xx", desc: "Unknown source or count_mode, or bad settings" }
], "Body: <code>charity_id</code>, <code>project_id</code>, <code>workflow_tracker: {source, count_mode, settings}</code>. The Period ends at the Project's next deadline, or today when it has none ahead.")}
], "Body: <code>charity_id</code>, <code>project_id</code>, <code>workflow_tracker: {source, count_mode, settings, contact_criteria}</code>. The Period ends at the Project's next deadline, or today when it has none ahead.")}
${endpointCard("POST", "/workflow_trackers", "Create a Workflow Tracker", true, [], [
{ code: "201", cls: "response-2xx", desc: "Workflow Tracker created" },
{ code: "403", cls: "response-4xx", desc: "Not an editor or reporter of the Organisation" },
{ code: "422", cls: "response-4xx", desc: "Validation failed" }
], "Body: <code>workflow_tracker: {charity_id, name, description, source, count_mode, settings}</code>. For <code>internal_referrals</code>, <code>settings</code> choose which Projects count as a referral: <code>{destinations: \"any\"}</code>, <code>{destinations: \"only\", project_ids: [...]}</code> or <code>{destinations: \"except\", project_ids: [...]}</code> (the default, with none listed). For the Cases sources, <code>settings: {case_form_id: ...}</code> counts only the Cases created with that Case Form; leave it out for any.")}
], "Body: <code>workflow_tracker: {charity_id, name, description, source, count_mode, settings, contact_criteria}</code>. <code>contact_criteria</code> (optional): Contact Filters criteria a Contact must meet for their items to count, e.g. <code>{age_to: {year: \"17\"}}</code>; <code>{}</code> counts every Contact. For <code>internal_referrals</code>, <code>settings</code> choose which Projects count as a referral: <code>{destinations: \"any\"}</code>, <code>{destinations: \"only\", project_ids: [...]}</code> or <code>{destinations: \"except\", project_ids: [...]}</code> (the default, with none listed). For the Cases sources, <code>settings: {case_form_id: ...}</code> counts only the Cases created with that Case Form; leave it out for any.")}
${endpointCard("PATCH", "/workflow_trackers/{id}", "Update a Workflow Tracker", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Workflow Tracker ID" }
], [
Expand Down