Skip to content

Commit

Permalink
adds nondisjunction lines to CDC (not really an AAP thing but tacking…
Browse files Browse the repository at this point in the history
… on here)
  • Loading branch information
eatyourpeas committed Oct 27, 2024
1 parent 66a5e54 commit 01c9a7e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/CentileChart/CentileChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ function CentileChart({
if (reference === 'uk-who' && measurementMethod === 'height') {
pubertyThresholds = makePubertyThresholds(domains, sex);
}
if (reference === 'uk-who') {
nondisjunctionThresholds = makeNonDisjunctionThresholds(domains, sex);
if (reference === 'uk-who' || reference === 'cdc') {
nondisjunctionThresholds = makeNonDisjunctionThresholds(domains, sex, reference);
}

const filteredMidParentalHeightData = useMemo(
Expand Down
30 changes: 28 additions & 2 deletions src/functions/nondisjunctionLines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,42 @@ export const nondisjunctionThresholds = {
],
};

export function makeNonDisjunctionThresholds(domains: Domains | null, sex: 'male' | 'female') {
export function makeNonDisjunctionThresholds(
domains: Domains | null,
sex: 'male' | 'female',
reference: 'cdc' | 'uk-who' | 'trisomy-21' | 'turner' | 'trisomy-21-aap',
): any[] {
if (!domains) {
return [];
}
const newNonDisjunctionThresholds: any[] = [];
for (const element of nondisjunctionThresholds[sex]) {
let selectedNondisjunctionThresholds;
if (reference === 'cdc') {
selectedNondisjunctionThresholds = nondisjunctionThresholdsCDC;
} else {
selectedNondisjunctionThresholds = nondisjunctionThresholds;
}

for (const element of selectedNondisjunctionThresholds[sex]) {
const dataSubArray = [];
dataSubArray.push({ x: element.x, y: domains.y[0], label: element.label });
dataSubArray.push({ x: element.x, y: domains.y[1], label: element.label });
newNonDisjunctionThresholds.push(dataSubArray);
}
return newNonDisjunctionThresholds;
}

export const nondisjunctionThresholdsCDC = {
male: [
{
x: 2,
label: 'Transition point from WHO to CDC reference',
},
],
female: [
{
x: 2,
label: 'Transition point from WHO to CDC reference',
},
],
};

0 comments on commit 01c9a7e

Please sign in to comment.