diff --git a/openapi.yaml b/openapi.yaml
index 7a01542..cdf7969 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -1075,6 +1075,13 @@ paths:
in the Organisation starts with. Existing projects keep their own level, and each project's level
can still be changed on its Preferences page. Only settings sent are changed. Only an
Organisation Admin may do this; other colleagues get 403. Returns the Organisation.
+
+ It also sets the Organisation's **Region** and **Industry** (`region_factor_option_id`,
+ `industry_factor_option_id`), as on Edit organisation profile. Localised Financial Values, such
+ as the TOM System's local employment and local spend Measures, are worked out from them for
+ every project that doesn't set its own. Take the ids from `GET /factor_options`; send null to
+ clear one, so national amounts apply. An Industry sent as the Region, or the other way round,
+ gets 422. Contribution figures update in the background a few minutes later.
operationId: updateCharity
security: [{tokenAuth: []}]
parameters:
@@ -1092,8 +1099,17 @@ paths:
description: >-
"Enable contacts to sign in using a participant pass". When false, a Contact's profile
hides the Participating As tab unless the Contact is already linked to a user.
+ region_factor_option_id:
+ type: integer
+ nullable: true
+ description: The Organisation's Region, a `dimension` region option from `GET /factor_options`
+ industry_factor_option_id:
+ type: integer
+ nullable: true
+ description: The Organisation's Industry, a `dimension` industry option from `GET /factor_options`
example:
- default_project_story_privacy: only_project_colleagues
+ region_factor_option_id: 7
+ industry_factor_option_id: 102
responses:
"200":
description: The Organisation, with the setting changed
@@ -4103,8 +4119,9 @@ paths:
What the Project's Project Preferences page shows: which Contact Forms create and edit
Contacts, which Contact statuses (Waiting List, Enrolled, Alumni, Declined) are switched on
with each one's form and baseline Surveys, editorial control, Case, Event and timesheet
- settings, the Case Form, Event Formats, the default privacy of new Stories and the Mailchimp
- list. Requires rights to change the Project's preferences (a Manager or an Organisation Admin).
+ settings, the Case Form, Event Formats, the default privacy of new Stories, the Mailchimp
+ list, and the Region and Industry its localised Financial Values use. Requires rights to change
+ the Project's preferences (a Manager or an Organisation Admin).
operationId: getProjectPreferences
security: [{tokenAuth: []}]
parameters:
@@ -6900,6 +6917,68 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'
+ /factor_options:
+ get:
+ tags: [Financial Values]
+ summary: List the Regions and Industries
+ description: |
+ The Regions and Industries an Organisation or Project can choose for localised Financial
+ Values, each with the factors it holds, in the order the tables list them. Makerble publishes
+ these tables, e.g. the TOM System 2024 "Location" sheet (each Region's median annual wage,
+ Regional GVA and National GVA) and "Industry" sheet (each Industry's GVA multiplier).
+
+ A localised Financial Value's formula names a factor as `dimension.key`, e.g.
+ `region.median_wage`. Pass an option's id as `region_factor_option_id` or
+ `industry_factor_option_id` to `PATCH /charities/{id}` or `PATCH /projects/{id}/preferences`.
+ operationId: listFactorOptions
+ security: [{tokenAuth: []}]
+ parameters:
+ - name: dimension
+ in: query
+ required: false
+ schema: { type: string, example: region }
+ description: Only this table's options, by its key (region or industry)
+ - $ref: '#/components/parameters/Page'
+ - $ref: '#/components/parameters/PerPage'
+ - $ref: '#/components/parameters/LastSyncDatetime'
+ responses:
+ "200":
+ description: A page of Regions and Industries
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: '#/components/schemas/PaginationEnvelope'
+ - type: object
+ properties:
+ data:
+ type: array
+ items: { $ref: '#/components/schemas/FactorOption' }
+ example:
+ page: 1
+ page_size: 1
+ page_count: 12
+ total_count: 12
+ data:
+ - id: 7
+ name: North East
+ dimension: region
+ dimension_name: Region
+ edition: TOM System 2024 Location
+ year: 2024
+ position: 0
+ factors:
+ - { key: median_wage, name: Median annual wage, value: '37666.5' }
+ - { key: national_gva, name: National GVA, value: '0.8' }
+ - { key: regional_gva, name: Regional GVA, value: '1.5718765958' }
+ updated_at: '2026-11-29T17:00:00Z'
+ "401":
+ $ref: '#/components/responses/Unauthorized'
+ "404":
+ $ref: '#/components/responses/NotFound'
+ "422":
+ $ref: '#/components/responses/UnprocessableEntity'
+
/financial_values:
get:
tags: [Financial Values]
@@ -27489,6 +27568,55 @@ components:
"Enable contacts to sign in using a participant pass" (Charity Preferences, Contacts). Off
by default.
example: false
+ region:
+ $ref: '#/components/schemas/FactorChoice'
+ industry:
+ $ref: '#/components/schemas/FactorChoice'
+
+ FactorChoice:
+ type: object
+ nullable: true
+ description: >-
+ A Region or Industry chosen for localised Financial Values: an id from `GET /factor_options`
+ and its name. Null when none is chosen.
+ properties:
+ id: { type: integer, example: 7 }
+ name: { type: string, example: North East }
+
+ FactorChoiceInEffect:
+ type: object
+ nullable: true
+ description: >-
+ The Region or Industry a project's localised Financial Values use: its own, or else its
+ organisation's (`source`). Null when neither is set, so national amounts apply.
+ properties:
+ id: { type: integer, example: 7 }
+ name: { type: string, example: North East }
+ source: { type: string, enum: [project, organisation] }
+
+ FactorOption:
+ type: object
+ description: >-
+ One option of a factor table Makerble publishes, e.g. the Region "North East" or the Industry
+ "Construction", with the factors it holds. A localised Financial Value's formula names a factor
+ as `dimension.key`, e.g. `region.median_wage`.
+ properties:
+ id: { type: integer, example: 7 }
+ name: { type: string, example: North East }
+ dimension: { type: string, example: region, description: The table's key, as a formula names it }
+ dimension_name: { type: string, example: Region }
+ edition: { type: string, nullable: true, example: TOM System 2024 Location }
+ year: { type: integer, nullable: true, example: 2024 }
+ position: { type: integer, description: Its place in the table's order }
+ factors:
+ type: array
+ items:
+ type: object
+ properties:
+ key: { type: string, example: regional_gva }
+ name: { type: string, example: Regional GVA }
+ value: { type: string, description: A decimal string, example: '1.5718765958' }
+ updated_at: { type: string, format: date-time }
DefaultProjectStoryPrivacy:
type: string
@@ -28119,6 +28247,24 @@ components:
project_id:
type: integer
readOnly: true
+ region_factor_option_id:
+ type: integer
+ nullable: true
+ description: >-
+ The Project's own Region for localised Financial Values, from `GET /factor_options`. Null to
+ use its organisation's.
+ industry_factor_option_id:
+ type: integer
+ nullable: true
+ description: >-
+ The Project's own Industry for localised Financial Values, from `GET /factor_options`. Null
+ to use its organisation's.
+ region:
+ allOf: [{ $ref: '#/components/schemas/FactorChoiceInEffect' }]
+ readOnly: true
+ industry:
+ allOf: [{ $ref: '#/components/schemas/FactorChoiceInEffect' }]
+ readOnly: true
add_enrolled_contacts_to_upcoming_events:
type: boolean
nullable: true
@@ -28867,6 +29013,20 @@ components:
enum: [only_project_colleagues, only_charity_colleagues, charity_plus_network, everyone]
description: Who may use it
project_ids: { type: array, items: { type: integer }, description: The projects it may be used in, for only_project_colleagues }
+ formula:
+ type: string
+ nullable: true
+ description: >-
+ For a localised Financial Value, whose amount depends on where the work happens or the
+ industry: arithmetic over factors from `GET /factor_options`, e.g.
+ `(industry.gva_multiplier - 1) * region.regional_gva`. Each project values it with its own
+ Region and Industry. Null for a fixed Financial Value.
+ localised: { type: boolean, description: Whether it has a formula }
+ national_amount:
+ type: string
+ nullable: true
+ description: For a localised Financial Value, the amount used where no Region or Industry is set (the same as amount). Null for a fixed one.
+ example: '0.8'
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
FinancialValueInput:
@@ -28888,6 +29048,12 @@ components:
publisher: { type: string }
short_description: { type: string }
calculation_description: { type: string }
+ formula:
+ type: string
+ description: >-
+ Makes it localised: arithmetic (numbers, + - * / and brackets) over factors named
+ `dimension.key`, e.g. `region.median_wage`. amount is then the national amount. A formula
+ naming a factor that doesn't exist, or using anything but arithmetic, gets 422.
ProjectFinancialValue:
type: object
description: One Financial Value put against one of a project's Metrics on its Financial Value calculator
diff --git a/server.js b/server.js
index 154208e..0ff91a7 100644
--- a/server.js
+++ b/server.js
@@ -1284,20 +1284,22 @@ function buildDocsPage() {
${endpointCard("GET", "/charities/{id}", "Get a single Organisation", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" }
], [
- { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps, default_project_story_privacy: the Story Privacy Level each new project in the Organisation starts with, and participant_pass_sign_in_enabled" },
+ { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps, default_project_story_privacy: the Story Privacy Level each new project in the Organisation starts with, participant_pass_sign_in_enabled, and region and industry ({id, name} or null): the Region and Industry its localised Financial Values use" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "404", cls: "response-4xx", desc: "Not found" }
])}
${endpointCard("PATCH", "/charities/{id}", "Change an Organisation's settings", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" },
{ name: "default_project_story_privacy", in: "body", type: "string", required: false, desc: "Default story level privacy setting on each project: the Story Privacy Level each new project starts with. One of only_project_colleagues (Project colleagues only), only_charity_colleagues (Organisation colleagues only), charity_plus_network (Network & organisation colleagues only) or everyone. Existing projects keep their own level." },
- { name: "participant_pass_sign_in_enabled", in: "body", type: "boolean", required: false, desc: "Enable contacts to sign in using a participant pass. When false, a Contact's profile hides the Participating As tab unless the Contact is already linked to a user." }
+ { name: "participant_pass_sign_in_enabled", in: "body", type: "boolean", required: false, desc: "Enable contacts to sign in using a participant pass. When false, a Contact's profile hides the Participating As tab unless the Contact is already linked to a user." },
+ { name: "region_factor_option_id", in: "body", type: "integer|null", required: false, desc: "The Organisation's Region, an id from GET /factor_options?dimension=region. Localised Financial Values use it for every project that doesn't set its own. null clears it." },
+ { name: "industry_factor_option_id", in: "body", type: "integer|null", required: false, desc: "The Organisation's Industry, an id from GET /factor_options?dimension=industry. null clears it." }
], [
{ code: "200", cls: "response-2xx", desc: "The Organisation, with the setting changed" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "Not an Organisation Admin of this Organisation" },
{ code: "404", cls: "response-4xx", desc: "Not found, or not one of your Organisations" },
- { code: "422", cls: "response-4xx", desc: "default_project_story_privacy isn't one of the four levels, or participant_pass_sign_in_enabled isn't true or false" }
+ { code: "422", cls: "response-4xx", desc: "default_project_story_privacy isn't one of the four levels, participant_pass_sign_in_enabled isn't true or false, or a Region or Industry id isn't one of that table's" }
], "Only an Organisation Admin can change these settings, the same people who can use Charity Preferences. Only the settings sent are changed.")}
@@ -1369,7 +1371,7 @@ function buildDocsPage() {
${endpointCard("GET", "/projects/{id}/preferences", "Get a Project's Project Preferences", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Project ID" }
], [
- { code: "200", cls: "response-2xx", desc: "The Project Preferences: Contact Forms and statuses (Waiting List, Enrolled, Alumni, Declined) with their forms and baseline Surveys, editorial control, Events, Cases, Timesheets, default Story privacy and the Mailchimp list" },
+ { code: "200", cls: "response-2xx", desc: "The Project Preferences: Contact Forms and statuses (Waiting List, Enrolled, Alumni, Declined) with their forms and baseline Surveys, editorial control, Events, Cases, Timesheets, default Story privacy, the Mailchimp list, and the Region and Industry for localised Financial Values: the project's own region_factor_option_id and industry_factor_option_id (null to use the organisation's), and region and industry in effect, {id, name, source} with source project or organisation" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "Not a Manager of the Project or an Organisation Admin (e.g. a Changemaker)" },
{ code: "404", cls: "response-4xx", desc: "Not found, or in an Organisation you don't work in" }
@@ -3442,6 +3444,7 @@ function buildDocsPage() {
A Financial Value is a published money value per person for an outcome, e.g. "Moving into work: £1,234 a year" from HACT, in the currency of its country. A project puts Financial Values against its Metrics (Changes and Indicators) on its Financial Value calculator (project › More Options › Financial Values). The project's financial value is each Metric's result times the amounts of its Financial Values, as on its Financial Calculator tile, added up separately for each currency.
You can use your own Financial Values, your organisations', those shared with you and those shared with everyone. One shared with only_project_colleagues can only be used in the projects in its project_ids.
A localised Financial Value depends on where the work happens or the industry, like the TOM System's local employment (the region's median wage) and local spend Measures. Its formula names factors from GET /factor_options, and each project values it with its own Region and Industry, or else its organisation's. Where neither is set, its national amount applies.
id, name, code, amount, currency, year, country, category, sources, publisher, short_description, calculation_description, verified, owner_type (Organisation or User), owner_id, privacy and project_ids" },
+ { code: "200", cls: "response-2xx", desc: "Paginated Financial Values, by name: id, name, code, amount, currency, year, country, category, sources, publisher, short_description, calculation_description, verified, owner_type (Organisation or User), owner_id, privacy, project_ids, and for a localised one its formula, localised and national_amount" },
{ code: "422", cls: "response-4xx", desc: "per_page over 200" }
])}
${endpointCard("GET", "/financial_values/{id}", "Get a Financial Value", true, [
@@ -3471,7 +3474,17 @@ function buildDocsPage() {
{ code: "201", cls: "response-2xx", desc: "The new Financial Value" },
{ code: "403", cls: "response-4xx", desc: "You aren't an Organisation Admin of organisation_id" },
{ code: "422", cls: "response-4xx", desc: "Something was wrong, e.g. a country that doesn't exist; existing_id when its owner already has a Financial Value with this name" }
- ], "Body: name, amount (per person, no currency symbol), year, country (a name; sets the currency) and privacy (Project colleagues only, Organisation colleagues only, Network & organisation colleagues only or Everyone) are required. Optional: organisation_id (leave out to make it your own), project_ids (for Project colleagues only), code, category and sources (names), publisher, short_description, calculation_description.")}
+ ], "Body: name, amount (per person, no currency symbol), year, country (a name; sets the currency) and privacy (Project colleagues only, Organisation colleagues only, Network & organisation colleagues only or Everyone) are required. Optional: organisation_id (leave out to make it your own), project_ids (for Project colleagues only), code, category and sources (names), publisher, short_description, calculation_description, and formula to make it localised (then amount is the national amount).")}
+ ${endpointCard("GET", "/factor_options", "List the Regions and Industries", true, [
+ { name: "dimension", type: "string", required: false, desc: "Only region or only industry" },
+ { name: "page", type: "integer", required: false, desc: "Page number" },
+ { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" },
+ { name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 incremental sync" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "Paginated options in table order: id, name, dimension, dimension_name, edition, year, position, factors (key, name, value) and updated_at" },
+ { code: "401", cls: "response-4xx", desc: "Not authenticated" },
+ { code: "422", cls: "response-4xx", desc: "per_page over 200" }
+ ], "The Regions and Industries an Organisation or Project can choose for localised Financial Values, from the tables Makerble publishes (e.g. the TOM System 2024 Location and Industry sheets). A formula names a factor as dimension.key, e.g. region.median_wage.")}
${endpointCard("GET", "/projects/{project_id}/financial_values", "List a project's Financial Values and their total", true, [
{ name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" },
{ name: "page", type: "integer", required: false, desc: "Page number" },