Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdc-heights #142

Merged
merged 8 commits into from
Jan 31, 2025
Merged
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
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.3.0",
"version": "7.3.1",
"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
2 changes: 1 addition & 1 deletion src/CentileChart/CentileChart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe('All tests relate to rendering the text in the height centile chart for
render(<CentileChart {...props} />);

// the default is to not render centile labels
expect(screen.queryAllByText('99.6th')[0]).toBeUndefined();
expect(screen.queryAllByText('99.6th')[0]).toBeInTheDocument();

// fireEvent.click(screen.getByTestId('gradient-labels-button'));
// expect(screen.getAllByText('99.6th')[0]).toBeInTheDocument();
Expand Down
8 changes: 4 additions & 4 deletions src/CentileChart/CentileChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import tailoredXTickValues from '../functions/tailoredXTickValues';
import defaultToggles from '../functions/defaultToggles';
import { tooltipText } from '../functions/tooltips';
import { delayedPubertyThreshold, makePubertyThresholds, lowerPubertyBorder } from '../functions/DelayedPuberty';
import { nondisjunctionThresholds, makeNonDisjunctionThresholds } from '../functions/nondisjunctionLines';
import { makeNonDisjunctionThresholds } from '../functions/nondisjunctionLines';
import { getFilteredMidParentalHeightData } from '../functions/getFilteredMidParentalHeightData';
import { isCrowded } from '../functions/isCrowded';
import { labelAngle } from '../functions/labelAngle';
Expand Down Expand Up @@ -104,7 +104,7 @@ function CentileChart({
const chartRef = useRef<any>();
const [active, setActive] = useState(false);
const [fullScreen, setFullScreen] = useState(true);
const [centileLabels, setCentileLabels] = useState(false);
const [centileLabels, setCentileLabels] = useState(true);

// save & destruct domains and data on initial render and when dependencies change

Expand Down Expand Up @@ -160,8 +160,8 @@ function CentileChart({
if (reference === 'uk-who' && measurementMethod === 'height') {
pubertyThresholds = makePubertyThresholds(domains, sex);
}
if (reference === 'uk-who' || reference === 'cdc') {
if (reference === 'cdc' && measurementMethod === 'ofc') {
if (reference === 'uk-who' || reference === 'cdc' || reference === 'who') {
if ((reference === 'cdc' || reference === 'who') && measurementMethod === 'ofc') {
// no nondisjunction lines for CDC OFC
nondisjunctionThresholds = null;
} else {
Expand Down
22 changes: 22 additions & 0 deletions src/RCPCHChart/RCPCHChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { maleCDCBMIExcess } from '../testParameters/measurements/maleCDCBMIExces
import { childTrisomyAAPData } from '../testParameters/measurements/childTrisomyAAPData.ts';
import { maleWeightT21AAPData } from '../testParameters/measurements/maleWeightT21AAP.ts';
import { whoToNineteenGirlHeight } from '../testParameters/measurements/whoHeightToNineteenGirl.ts';
import { whoOneToFiveBoysHeight } from '../testParameters/measurements/whoHeightBoysOneToFive.ts';
// import { cdcFentonGirlLength } from '../testParameters/measurements/fenton/cdcFentonGirlLength';
// import { cdcFentonGirlWeight } from '../testParameters/measurements/fenton/cdcFentonGirlWeight.ts';

Expand Down Expand Up @@ -742,6 +743,27 @@ export const CentileChartTrisomy21AAPBoysHeadCircumference: Story = {
},
};

export const CentileChartWHOBoysHeight: Story = {
args: {
title: 'Patient Name - Hospital Number',
measurementMethod: 'height',
reference: 'who',
sex: 'male',
measurements: {
height: whoOneToFiveBoysHeight,
},
midParentalHeightData: {},
enableZoom: true,
chartType: 'centile',
enableExport: false,
exportChartCallback: () => {},
theme: 'tanner3',
customThemeStyles: {},
clinicianFocus: true,
logoVariant: 'bottom',
},
};

export const CentileChartWHOGirlsHeight: Story = {
args: {
title: 'Patient Name - Hospital Number',
Expand Down
2 changes: 1 addition & 1 deletion src/RCPCHChart/RCPCHChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const RCPCHChart: React.FC<RCPCHChartProps> = ({
);

// uncomment in development
// console.log("loading from locally...");
// console.log('loading from locally...');

// create subtitle from sex, reference and measurementMethod
const subtitleReferenceMeasurementMethod = `${nameForReference(reference)} - ${nameForMeasurementMethod(measurementMethod)}`;
Expand Down
4,580 changes: 2,312 additions & 2,268 deletions src/chartdata/cdc_height_female_centile_data.ts

Large diffs are not rendered by default.

2,388 changes: 2,388 additions & 0 deletions src/chartdata/cdc_height_female_centile_data_old.ts

Large diffs are not rendered by default.

4,580 changes: 2,312 additions & 2,268 deletions src/chartdata/cdc_height_male_centile_data.ts

Large diffs are not rendered by default.

2,388 changes: 2,388 additions & 0 deletions src/chartdata/cdc_height_male_centile_data_old.ts

Large diffs are not rendered by default.

4,576 changes: 2,310 additions & 2,266 deletions src/chartdata/cdc_weight_female_centile_data.ts

Large diffs are not rendered by default.

2,388 changes: 2,388 additions & 0 deletions src/chartdata/cdc_weight_female_centile_data_old.ts

Large diffs are not rendered by default.

4,580 changes: 2,312 additions & 2,268 deletions src/chartdata/cdc_weight_male_centile_data.ts

Large diffs are not rendered by default.

2,388 changes: 2,388 additions & 0 deletions src/chartdata/cdc_weight_male_centile_data_old.ts

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/chartdata/who_bmi_female_centile_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: -2.33,
centile: 1,
data: [
{ l: 1, x: 5.0, y: 12.4187 },
{ l: 1, x: 5.08, y: 12.4123 },
{ l: 1, x: 5.17, y: 12.4052 },
{ l: 1, x: 5.25, y: 12.3988 },
Expand Down Expand Up @@ -1135,6 +1136,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: -1.88,
centile: 3,
data: [
{ l: 3, x: 5.0, y: 12.8807 },
{ l: 3, x: 5.08, y: 12.8745 },
{ l: 3, x: 5.17, y: 12.8675 },
{ l: 3, x: 5.25, y: 12.8613 },
Expand Down Expand Up @@ -1309,6 +1311,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: -1.64,
centile: 5,
data: [
{ l: 5, x: 5.0, y: 13.1386 },
{ l: 5, x: 5.08, y: 13.1326 },
{ l: 5, x: 5.17, y: 13.1258 },
{ l: 5, x: 5.25, y: 13.1198 },
Expand Down Expand Up @@ -1483,6 +1486,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: -1.28,
centile: 10,
data: [
{ l: 10, x: 5.0, y: 13.5552 },
{ l: 10, x: 5.08, y: 13.5498 },
{ l: 10, x: 5.17, y: 13.5436 },
{ l: 10, x: 5.25, y: 13.5382 },
Expand Down Expand Up @@ -1657,6 +1661,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: -1.04,
centile: 15,
data: [
{ l: 15, x: 5.0, y: 13.8507 },
{ l: 15, x: 5.08, y: 13.8457 },
{ l: 15, x: 5.17, y: 13.8402 },
{ l: 15, x: 5.25, y: 13.8353 },
Expand Down Expand Up @@ -1831,6 +1836,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 0.0,
centile: 50,
data: [
{ l: 50, x: 5.0, y: 15.2447 },
{ l: 50, x: 5.08, y: 15.2441 },
{ l: 50, x: 5.17, y: 15.2434 },
{ l: 50, x: 5.25, y: 15.2433 },
Expand Down Expand Up @@ -2005,6 +2011,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 1.04,
centile: 85,
data: [
{ l: 85, x: 5.0, y: 16.9267 },
{ l: 85, x: 5.08, y: 16.9355 },
{ l: 85, x: 5.17, y: 16.9453 },
{ l: 85, x: 5.25, y: 16.9557 },
Expand Down Expand Up @@ -2179,6 +2186,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 1.28,
centile: 90,
data: [
{ l: 90, x: 5.0, y: 17.3764 },
{ l: 90, x: 5.08, y: 17.3885 },
{ l: 90, x: 5.17, y: 17.4021 },
{ l: 90, x: 5.25, y: 17.4162 },
Expand Down Expand Up @@ -2353,6 +2361,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 1.64,
centile: 95,
data: [
{ l: 95, x: 5.0, y: 18.0854 },
{ l: 95, x: 5.08, y: 18.1035 },
{ l: 95, x: 5.17, y: 18.1238 },
{ l: 95, x: 5.25, y: 18.1446 },
Expand Down Expand Up @@ -2527,6 +2536,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 1.88,
centile: 97,
data: [
{ l: 97, x: 5.0, y: 18.5755 },
{ l: 97, x: 5.08, y: 18.5981 },
{ l: 97, x: 5.17, y: 18.6237 },
{ l: 97, x: 5.25, y: 18.6497 },
Expand Down Expand Up @@ -2701,6 +2711,7 @@ export const whoBMIFemaleCentileData: ReferenceGroup = {
sds: 2.33,
centile: 99,
data: [
{ l: 99, x: 5.0, y: 19.572 },
{ l: 99, x: 5.08, y: 19.6053 },
{ l: 99, x: 5.17, y: 19.6431 },
{ l: 99, x: 5.25, y: 19.6813 },
Expand Down
11 changes: 11 additions & 0 deletions src/chartdata/who_bmi_male_centile_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: -2.33,
centile: 1,
data: [
{ l: 1, x: 5.0, y: 12.7231 },
{ l: 1, x: 5.08, y: 12.72 },
{ l: 1, x: 5.17, y: 12.7165 },
{ l: 1, x: 5.25, y: 12.7138 },
Expand Down Expand Up @@ -1135,6 +1136,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: -1.88,
centile: 3,
data: [
{ l: 3, x: 5.0, y: 13.1513 },
{ l: 3, x: 5.08, y: 13.1477 },
{ l: 3, x: 5.17, y: 13.1435 },
{ l: 3, x: 5.25, y: 13.1403 },
Expand Down Expand Up @@ -1309,6 +1311,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: -1.64,
centile: 5,
data: [
{ l: 5, x: 5.0, y: 13.3882 },
{ l: 5, x: 5.08, y: 13.3844 },
{ l: 5, x: 5.17, y: 13.38 },
{ l: 5, x: 5.25, y: 13.3766 },
Expand Down Expand Up @@ -1483,6 +1486,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: -1.28,
centile: 10,
data: [
{ l: 10, x: 5.0, y: 13.7676 },
{ l: 10, x: 5.08, y: 13.7637 },
{ l: 10, x: 5.17, y: 13.7592 },
{ l: 10, x: 5.25, y: 13.7558 },
Expand Down Expand Up @@ -1657,6 +1661,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: -1.04,
centile: 15,
data: [
{ l: 15, x: 5.0, y: 14.0343 },
{ l: 15, x: 5.08, y: 14.0304 },
{ l: 15, x: 5.17, y: 14.026 },
{ l: 15, x: 5.25, y: 14.0226 },
Expand Down Expand Up @@ -1831,6 +1836,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 0.0,
centile: 50,
data: [
{ l: 50, x: 5.0, y: 15.2663 },
{ l: 50, x: 5.08, y: 15.2641 },
{ l: 50, x: 5.17, y: 15.2616 },
{ l: 50, x: 5.25, y: 15.2604 },
Expand Down Expand Up @@ -2005,6 +2011,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 1.04,
centile: 85,
data: [
{ l: 85, x: 5.0, y: 16.6966 },
{ l: 85, x: 5.08, y: 16.6995 },
{ l: 85, x: 5.17, y: 16.7028 },
{ l: 85, x: 5.25, y: 16.7078 },
Expand Down Expand Up @@ -2179,6 +2186,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 1.28,
centile: 90,
data: [
{ l: 90, x: 5.0, y: 17.0689 },
{ l: 90, x: 5.08, y: 17.0737 },
{ l: 90, x: 5.17, y: 17.0792 },
{ l: 90, x: 5.25, y: 17.0865 },
Expand Down Expand Up @@ -2353,6 +2361,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 1.64,
centile: 95,
data: [
{ l: 95, x: 5.0, y: 17.6475 },
{ l: 95, x: 5.08, y: 17.6558 },
{ l: 95, x: 5.17, y: 17.6652 },
{ l: 95, x: 5.25, y: 17.6766 },
Expand Down Expand Up @@ -2527,6 +2536,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 1.88,
centile: 97,
data: [
{ l: 97, x: 5.0, y: 18.0416 },
{ l: 97, x: 5.08, y: 18.0525 },
{ l: 97, x: 5.17, y: 18.065 },
{ l: 97, x: 5.25, y: 18.0796 },
Expand Down Expand Up @@ -2701,6 +2711,7 @@ export const whoBMIMaleCentileData: ReferenceGroup = {
sds: 2.33,
centile: 99,
data: [
{ l: 99, x: 5.0, y: 18.8283 },
{ l: 99, x: 5.08, y: 18.8454 },
{ l: 99, x: 5.17, y: 18.865 },
{ l: 99, x: 5.25, y: 18.8871 },
Expand Down
11 changes: 11 additions & 0 deletions src/chartdata/who_height_female_centile_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: -2.33,
centile: 1,
data: [
{ l: 1, x: 5.0, y: 98.0763 },
{ l: 1, x: 5.08, y: 98.4978 },
{ l: 1, x: 5.17, y: 98.9459 },
{ l: 1, x: 5.25, y: 99.3893 },
Expand Down Expand Up @@ -1135,6 +1136,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: -1.88,
centile: 3,
data: [
{ l: 3, x: 5.0, y: 100.1893 },
{ l: 3, x: 5.08, y: 100.6243 },
{ l: 3, x: 5.17, y: 101.0869 },
{ l: 3, x: 5.25, y: 101.5448 },
Expand Down Expand Up @@ -1309,6 +1311,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: -1.64,
centile: 5,
data: [
{ l: 5, x: 5.0, y: 101.3082 },
{ l: 5, x: 5.08, y: 101.7502 },
{ l: 5, x: 5.17, y: 102.2206 },
{ l: 5, x: 5.25, y: 102.6862 },
Expand Down Expand Up @@ -1483,6 +1486,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: -1.28,
centile: 10,
data: [
{ l: 10, x: 5.0, y: 103.0314 },
{ l: 10, x: 5.08, y: 103.4843 },
{ l: 10, x: 5.17, y: 103.9666 },
{ l: 10, x: 5.25, y: 104.4441 },
Expand Down Expand Up @@ -1657,6 +1661,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: -1.04,
centile: 15,
data: [
{ l: 15, x: 5.0, y: 104.1943 },
{ l: 15, x: 5.08, y: 104.6547 },
{ l: 15, x: 5.17, y: 105.145 },
{ l: 15, x: 5.25, y: 105.6305 },
Expand Down Expand Up @@ -1831,6 +1836,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 0.0,
centile: 50,
data: [
{ l: 50, x: 5.0, y: 109.11 },
{ l: 50, x: 5.08, y: 109.6016 },
{ l: 50, x: 5.17, y: 110.1258 },
{ l: 50, x: 5.25, y: 110.6451 },
Expand Down Expand Up @@ -2005,6 +2011,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 1.04,
centile: 85,
data: [
{ l: 85, x: 5.0, y: 114.0257 },
{ l: 85, x: 5.08, y: 114.5485 },
{ l: 85, x: 5.17, y: 115.1066 },
{ l: 85, x: 5.25, y: 115.6597 },
Expand Down Expand Up @@ -2179,6 +2186,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 1.28,
centile: 90,
data: [
{ l: 90, x: 5.0, y: 115.1886 },
{ l: 90, x: 5.08, y: 115.7189 },
{ l: 90, x: 5.17, y: 116.285 },
{ l: 90, x: 5.25, y: 116.8461 },
Expand Down Expand Up @@ -2353,6 +2361,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 1.64,
centile: 95,
data: [
{ l: 95, x: 5.0, y: 116.9118 },
{ l: 95, x: 5.08, y: 117.453 },
{ l: 95, x: 5.17, y: 118.031 },
{ l: 95, x: 5.25, y: 118.604 },
Expand Down Expand Up @@ -2527,6 +2536,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 1.88,
centile: 97,
data: [
{ l: 97, x: 5.0, y: 118.0307 },
{ l: 97, x: 5.08, y: 118.5789 },
{ l: 97, x: 5.17, y: 119.1647 },
{ l: 97, x: 5.25, y: 119.7454 },
Expand Down Expand Up @@ -2701,6 +2711,7 @@ export const whoHeightFemaleCentileData: ReferenceGroup = {
sds: 2.33,
centile: 99,
data: [
{ l: 99, x: 5.0, y: 120.1437 },
{ l: 99, x: 5.08, y: 120.7054 },
{ l: 99, x: 5.17, y: 121.3057 },
{ l: 99, x: 5.25, y: 121.9009 },
Expand Down
Loading