Skip to Content
RoutesCalculated

Calculated Values

GET /v1/surveys/:surveyId/calculated/:calculationCode

Calculated values for a survey, returned as metric records. Requires the same scopes as Get Survey: survey.read and universal_tracker_value.read.

Model interface schema in TypeScript:

interface CalculatedScoreRecord { // Calculated metric definition - generated on request, never stored, so it has no _id to look up universalTracker: { code: string, name: string, valueLabel: string, type: 'generated', valueType: 'number' | 'text', }, value?: number, valueType: 'number' | 'text', valueData: { data: number | string }, // 'verified' only when every answer the scores are based on is verified status: 'verified' | 'updated', // Reporting level (node) Id - ObjectId initiativeId: string, // Survey period end date - ISO 8601 format; null when the survey has none effectiveDate: Date | null, // Reporting period period: 'monthly' | 'quarterly' | 'yearly', surveyType: 'default' | 'aggregation', // Source survey reference compositeData: { surveyId: string }, }

Supported calculation codes:

CodeDescription
wfn_2024Workforce Nutrition 2024 scorecard: pillar scores, total and rating

Unsupported codes return 400 with the list of supported codes in the error’s userMessage field.

Get WFN 2024 scores

GET /v1/surveys/:surveyId/calculated/wfn_2024

Codes:

CodeMeaningType
wfn/2024/score/nutrition_educationNutrition Education pillar scorenumber
wfn/2024/score/health_checksNutrition Related Health Checks And Follow-Up pillar scorenumber
wfn/2024/score/healthy_food_at_workHealthy Food at Work pillar scorenumber
wfn/2024/score/breastfeeding_supportBreastfeeding Support pillar scorenumber
wfn/2024/score/totalSum of pillar scoresnumber
wfn/2024/score/ratingBeginner, Bronze, Silver or Goldtext

Only answers with status updated or verified count; rejected answers are ignored. A pillar with no answered questions produces no record. A survey with no answered WFN questions returns an empty data array. If scores cannot be calculated for a survey, the request returns 422 with a userMessage.

Request

curl --location 'https://api-singapore.g17.eco/v1/surveys/62d9530ce3e05eca98c84663/calculated/wfn_2024' \ --header 'Authorization: Bearer TOKEN_HERE'

Response

{ "success": true, "data": [ { "universalTracker": { "code": "wfn/2024/score/nutrition_education", "name": "Nutrition Education score", "valueLabel": "Nutrition Education score", "type": "generated", "valueType": "number" }, "value": 12, "valueType": "number", "valueData": { "data": 12 }, "status": "verified", "initiativeId": "62d9530ce3e05eca98c8465d", "effectiveDate": "2025-12-31T23:59:59.999Z", "period": "yearly", "surveyType": "default", "compositeData": { "surveyId": "62d9530ce3e05eca98c84663" } }, { "universalTracker": { "code": "wfn/2024/score/total", "name": "WFN total score", "valueLabel": "WFN total score", "type": "generated", "valueType": "number" }, "value": 12, "valueType": "number", "valueData": { "data": 12 }, "status": "verified", "initiativeId": "62d9530ce3e05eca98c8465d", "effectiveDate": "2025-12-31T23:59:59.999Z", "period": "yearly", "surveyType": "default", "compositeData": { "surveyId": "62d9530ce3e05eca98c84663" } }, { "universalTracker": { "code": "wfn/2024/score/rating", "name": "WFN rating", "valueLabel": "WFN rating", "type": "generated", "valueType": "text" }, "valueType": "text", "valueData": { "data": "Beginner" }, "status": "verified", "initiativeId": "62d9530ce3e05eca98c8465d", "effectiveDate": "2025-12-31T23:59:59.999Z", "period": "yearly", "surveyType": "default", "compositeData": { "surveyId": "62d9530ce3e05eca98c84663" } } ] }
Last updated on