From 22e4b5f354766d55d527f0be37429a75f6638e06 Mon Sep 17 00:00:00 2001 From: Celine Pelletier Date: Fri, 30 Aug 2024 15:01:18 -0400 Subject: [PATCH] feat: SKFP-1208 add ethnicity in statistics endpoint --- src/app.test.ts | 7 +++++++ src/endpoints/statistics/index.ts | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app.test.ts b/src/app.test.ts index 239bf7b..f19c5f6 100644 --- a/src/app.test.ts +++ b/src/app.test.ts @@ -115,6 +115,13 @@ describe('Express app (without Arranger)', () => { 'Native Hawaiian or Other Pacific Islander': 8, 'not available': 3, }, + ethnicity: { + 'Not Hispanic or Latino': 20460, + NoInformation: 6263, + 'Hispanic or Latino': 4107, + 'not available': 1419, + unknown: 775, + }, diagnosis: [ { mondo_id: 'speech disorder (MONDO:0004730)', diff --git a/src/endpoints/statistics/index.ts b/src/endpoints/statistics/index.ts index 092ccad..875910d 100644 --- a/src/endpoints/statistics/index.ts +++ b/src/endpoints/statistics/index.ts @@ -24,6 +24,7 @@ export type Statistics = { sex: Record; downSyndromeStatus: Record; race: Record; + ethnicity: Record; diagnosis: Diagnosis[]; }; @@ -224,6 +225,8 @@ export const fetchDemographicsStats = async (client: Client): Promise { + acc[curr.key] = curr.doc_count; + return acc; + }, {}); + + return [sex, downSyndromeStatus, race, ethnicity]; }; export const fetchTopDiagnosis = async (client: Client): Promise => { @@ -322,6 +330,7 @@ export const getStatistics = async (): Promise => { sex: results[9][0], downSyndromeStatus: results[9][1], race: results[9][2], + ethnicity: results[9][3], diagnosis, }; };