Skip to content

Commit

Permalink
Merge pull request #122 from rcpch:eatyourpeas/issue118
Browse files Browse the repository at this point in the history
percentage-median-bmi-label-fix
  • Loading branch information
eatyourpeas authored Oct 25, 2024
2 parents cbce0b8 + f6451f7 commit 4ff0f1b
Show file tree
Hide file tree
Showing 4 changed files with 2,396 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rcpch/digital-growth-charts-react-component-library",
"version": "7.1.3",
"version": "7.1.4",
"description": "A React component library for the RCPCH digital growth charts using Rollup, TypeScript and Styled-Components",
"main": "build/index.js",
"module": "build/esm.index.js",
Expand Down
20 changes: 20 additions & 0 deletions src/RCPCHChart/RCPCHChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { sdsTenYearGirlData } from '../testParameters/measurements/sdsTenYearGir
import { smallChildJustOverTwo } from '../testParameters/measurements/smallChildJustOverTwo';
import { girlMidparentalheightCDC } from '../testParameters/measurements/girlMidparentalheightCDC.ts';
import { girlMidparentalHeightUKWHO } from '../testParameters/measurements/girlMidparentalheightUKWHO.ts';
import { prematureGirlBMI } from '../testParameters/measurements/prematureGirlBMI.ts';
// import { cdcFentonGirlLength } from '../testParameters/measurements/fenton/cdcFentonGirlLength';
// import { cdcFentonGirlWeight } from '../testParameters/measurements/fenton/cdcFentonGirlWeight.ts';

Expand Down Expand Up @@ -168,6 +169,25 @@ export const CentileChartUKWHOGirlsBMI: Story = {
},
};

export const CentileChartUKWHOPrematureGirlsBMI: Story = {
args: {
title: 'Patient Name - Hospital Number',
measurementMethod: 'bmi',
reference: 'uk-who',
sex: 'female',
measurements: {
bmi: prematureGirlBMI,
},
midParentalHeightData: {},
enableZoom: true,
chartType: 'centile',
enableExport: false,
exportChartCallback: () => {},
theme: 'tanner2',
customThemeStyles: {},
},
};

export const CentileChartUKWHOGirlsHeadCircumference: Story = {
args: {
title: 'Patient Name - Hospital Number',
Expand Down
13 changes: 3 additions & 10 deletions src/functions/tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,24 +310,16 @@ export function tooltipText(
} else {
// over 42 weeks
// if no errors, return the ages, measurement and calculations
let correctedPercentageMedianBMI = '';
let chronologicalPercentageMedianBMI = '';
if (measurementMethod === 'bmi') {
correctedPercentageMedianBMI = `Percentage median BMI: ${Math.round(corrected_percentage_median_bmi)}%`;
chronologicalPercentageMedianBMI = `Percentage median BMI: ${Math.round(chronological_percentage_median_bmi)}%`;
returnStringList.push(correctedPercentageMedianBMI);
returnStringList.push(chronologicalPercentageMedianBMI);
}

// sds in square brackets
const sds_string = `[SDS: ${sds > 0 ? '+' + Math.round(sds * 1000) / 1000 : Math.round(sds * 1000) / 1000}]`;
const sds_string = `SDS: ${sds > 0 ? '+' + Math.round(sds * 1000) / 1000 : Math.round(sds * 1000) / 1000}`;

if (age_type === 'corrected_age' && x > 0.0383) {
returnStringList.push(`Corrected age: ${calendar_age} on ${formatted_observation_date}`);
returnStringList.push(`${comment}`);
returnStringList.push(`${y} ${measurementSuffix(measurementMethod)}`);
returnStringList.push(`${clinicianFocus ? sds_string : finalCentile}`);
if (measurementMethod === 'bmi') {
const correctedPercentageMedianBMI = `Percentage median BMI: ${Math.round(corrected_percentage_median_bmi)}%`;
returnStringList.push(`${correctedPercentageMedianBMI}`);
}
return returnStringList;
Expand All @@ -339,6 +331,7 @@ export function tooltipText(
returnStringList.push(`${y} ${measurementSuffix(measurementMethod)}`);
returnStringList.push(`${clinicianFocus ? sds_string : finalCentile}`);
if (measurementMethod === 'bmi') {
const chronologicalPercentageMedianBMI = `Percentage median BMI: ${Math.round(chronological_percentage_median_bmi)}%`;
returnStringList.push(`${chronologicalPercentageMedianBMI}`);
}
return returnStringList;
Expand Down
Loading

0 comments on commit 4ff0f1b

Please sign in to comment.