-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcdc_standards_example.dart
More file actions
83 lines (73 loc) · 2.6 KB
/
Copy pathcdc_standards_example.dart
File metadata and controls
83 lines (73 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// ignore_for_file: avoid_print
import 'package:growth_standards/growth_standards.dart';
void main() {
print('====================================================');
print(' CDC Clinical Growth Standards (2 to 20 Years)');
print('====================================================\n');
final cdc220 = GrowthStandard.cdc.from2YearsAndAbove;
final childAge = Age(
Date(year: 2016, month: Months.june, date: 1),
observedDate: Date(year: 2024, month: Months.june, date: 1),
); // 8 years old
const sex = Sex.male;
// 1. CDC Weight-for-Age (2-20y)
final cdcWfa = cdc220.weightForAge(
sex: sex,
age: childAge,
weight: Mass$Kilogram(26.5),
);
print(
'1. CDC Weight-for-Age (8y): Z = ${cdcWfa.zScore()} SD | P = ${cdcWfa.percentile()}%',
);
// 2. CDC Stature-for-Age (2-20y)
final cdcStature = cdc220.statureForAge(
sex: sex,
age: childAge,
lengthHeight: Length$Centimeter(128.0),
measure: LengthHeightMeasurementPosition.standing,
);
print(
'2. CDC Stature-for-Age (8y): Z = ${cdcStature.zScore()} SD | P = ${cdcStature.percentile()}%',
);
// 3. CDC BMI-for-Age (2-20y)
final cdcBmi = cdc220.bodyMassIndexForAge(
sex: sex,
age: childAge,
bodyMassIndexMeasurement: CDCBodyMassIndexMeasurement(16.18),
);
print(
'3. CDC BMI-for-Age (8y): Z = ${cdcBmi.zScore()} SD | P = ${cdcBmi.percentile()}%',
);
// 4. CDC Infant Weight-for-Age (0-36m)
final cdcInfant = GrowthStandard.cdc.fromBirthTo36Months;
final infantAge = Age(
Date(year: 2023, month: Months.january, date: 1),
observedDate: Date(year: 2024, month: Months.january, date: 1),
); // 12 months old
final cdcInfantWfa = cdcInfant.weightForAge(
sex: sex,
age: infantAge,
weight: Mass$Kilogram(10.5),
);
print(
'4. CDC Infant Weight-for-Age (12m): Z = ${cdcInfantWfa.zScore()} SD | P = ${cdcInfantWfa.percentile()}%',
);
// 5. CDC Infant Head Circumference-for-Age (0-36m)
final cdcInfantHc = cdcInfant.headCircumferenceForAge(
sex: sex,
age: infantAge,
measurementResult: Length$Centimeter(46.8),
);
print(
'5. CDC Infant Head Circumference (12m): Z = ${cdcInfantHc.zScore()} SD | P = ${cdcInfantHc.percentile()}%',
);
// Render CDC Chart in Percentile Mode
print('\nGenerating CDC Percentile Growth Chart SVG...');
final cdcConfig = GrowthChartConfig(
displayMode: GrowthChartDisplayMode.percentile,
title: 'CDC Weight-for-Age Clinical Record (Male, 8 Years)',
theme: GrowthChartTheme.boy(),
);
cdcWfa.saveSvg('doc/samples/cdc_wfa_percentile.svg', config: cdcConfig);
print('Saved CDC chart to doc/samples/');
}