forked from MGH-MPEC/CEPAC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimContext.cpp
More file actions
5675 lines (5105 loc) · 266 KB
/
SimContext.cpp
File metadata and controls
5675 lines (5105 loc) · 266 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "include.h"
/* Constructor takes run name as parameter */
SimContext::SimContext(string runName) {
counter=0;
inputFileName = runName;
inputFileName.append(".in");
runSpecsInputs.runName = runName;
}
/* Destructor cleans up the allocated memory for art and proph inputs */
SimContext::~SimContext(void) {
for (int i = 0; i < ART_NUM_LINES; i++) {
delete artInputs[i];
delete pedsARTInputs[i];
delete adolescentARTInputs[i];
}
for (int i = 0; i < PROPH_NUM_TYPES; i++) {
for (int j = 0; j < OI_NUM; j++) {
for (int k = 0; k < PROPH_NUM; k++) {
delete prophsInputs[i][j][k];
delete pedsProphsInputs[i][j][k];
}
}
}
}
/* Initialize the number of patients to trace*/
int SimContext::numPatientsToTrace = MAX_NUM_TRACES;
/* Initialize the constant character strings */
const char *SimContext::CD4_STRATA_STRS[] = {
"CD4vlo", "CD4_lo", "CD4mlo", "CD4mhi", "CD4_hi", "CD4vhi", "CD4unk"
};
const char *SimContext::HVL_STRATA_STRS[] = {
"HVLvlo", "HVL_lo", "HVLmlo", "HVLmed", "HVLmhi", "HVL_hi", "HVLvhi", "HVLunk"
};
const double SimContext::HVL_STRATA_MIDPTS[] = {
10.0, 250.0, 1750.0, 6500.0, 20000.0, 65000.0, 550000.0
};
const char *SimContext::GENDER_STRS[] = {
"male", "female"
};
const char *SimContext::TRANSM_RISK_STRS[] = {
"MSM", "IDU", "Other"
};
char SimContext::OI_STRS[SimContext::OI_NUM][32]; // OI_STRS is set during readRunSpecsInputs
char SimContext::DTH_CAUSES_STRS[SimContext::DTH_NUM_CAUSES][32]; // DTH_CAUSES_STRS is set during readRunSpecsInputs, readCHRMsInputs, and readCohortInputs
const char *SimContext::HIST_OI_CATS_STRS[] = {
"NoOIHist", "MildOIHist", "SevrOIHist"
};
char SimContext::CHRM_STRS[SimContext::CHRM_NUM][32]; // CHRM_STRS is set during readCHRMsInputs
char SimContext::RISK_FACT_STRS[SimContext::RISK_FACT_NUM][32]; // RISK_FACT_STRS is set during readCohortInputs
const char *SimContext::CHRM_AGE_CAT_STRS[]={
"CHRMs Age Bucket 1","CHRMs Age Bucket 2","CHRMs Age Bucket 3","CHRMs Age Bucket 4","CHRMs Age Bucket 5","CHRMs Age Bucket 6","CHRMs Age Bucket 7"
};
const char *SimContext::OUTPUT_AGE_CAT_STRS[]={
"<20","20-24","25-29","30-34","35-39","40-44","45-49","50-54","55-59","60-64","65-69","70-74","75-79",">=80"
};
const char *SimContext::LINKAGE_STATS_AGE_CAT_STRS[]={
"<15","15-19","20-24","25-29","30-34","35-39","40-44","45-49",">50"
};
const char *SimContext::COST_CD4_STRATA_STRS[] = {
"CD4vlo", "CD4_lo", "CD4mlo", "CD4mhi", "CD4_hi", "CD4vhi", "CD4Unknown", "CD4All"
};
const char *SimContext::COST_SUBGROUPS_STRS[] = {
"All Patients", "HIV-", "HIV+", "HIV+ Pre Linkage", "HIV+ Pre ART In Care", "On ART", "LTFU After ART", "LTFU Never had ART", "RTC", "On ART Never Lost", "On ART first 6 mths", "On 1st Line ART", "On 2nd Line or Higher ART"
};
const char *SimContext::CLINIC_VISITS_STRS[] = {
"initial", "acute", "sched"
};
const char *SimContext::EMERGENCY_TYPE_STRS[] = {
"Acute OI", "Testing", "ART Policies", "OI Proph Policies", "Routine"
};
const char *SimContext::ART_EFF_STRS[] = {
"suppressed", "failure"
};
const char *SimContext::CD4_RESPONSE_STRS[] = {
"Type_1", "Type_2", "Type_3", "Type_4"
};
const char *SimContext::RESP_TYPE_STRS[] = {
"Full Responder", "Partial Responder", "Non Responder"
};
const char *SimContext::HET_OUTCOME_STRS[]={
"Suppression", "Late Failure", "ART Effect OI","ART Effect CHRMs", "ART Effect Mortality",
"Resistance", "Toxicity", "Cost", "Restart Regimen", "Resuppression"
};
const char *SimContext::ART_TOX_SEVERITY_STRS[] = {
"Min","Chr","Maj","Dth"
};
const char *SimContext::ART_FAIL_TYPE_STRS[] = {
"Virologic", "Immunologic", "Clinical", "Not Failed"
};
const char *SimContext::ART_STOP_TYPE_STRS[] = {
"Max Months on ART", "With Major Toxicity","With Chronic Toxicity", "On Observed Failure", "Fail and CD4", "Fail and Severe OI",
"Fail and Max Months", "LTFU", "Not Stopped", "STI"
};
const char *SimContext::PROPH_TYPE_STRS[] = {
"PRIMARY", "SECONDARY"
};
const char *SimContext::COST_TYPES_STRS[] = {
"Direct Medical", "Direct Nonmedical", "Time", "Indirect"
};
const char *SimContext::TB_STRAIN_STRS[] = {
"dsTB", "mdrTB", "xdrTB"
};
const char *SimContext::TB_STATE_STRS[] = {
"Uninfected", "Latent", "Active Pulmonary", "Active Extrapulmonary","Previously Treated", "Treatment Default"
};
const char *SimContext::TB_TRACKER_STRS[] = {
"Sputum Bacillary Load Hi", "Immune Reactive", "TB Symptoms"
};
const char *SimContext::TB_DIAG_STATUS_STRS[] = {
"Pos", "Neg"
};
const char *SimContext::TB_UNFAVORABLE_STRS[] = {
"Failure", "Relapse", "LTFU", "Death"
};
const char *SimContext::HIV_ID_STRS[] = {
"HIVneg", "unidentHIV+", "identHIV+"
};
const char *SimContext::HIV_POS_STRS[] = {
"HIVasym", "HIVsymp", "HIVacut"
};
const char *SimContext::HIV_EXT_INF_STRS[] = {
"HIVneg_hiRisk", "HIVasym", "HIVsymp", "HIVacut", "HIVneg_loRisk"
};
const char *SimContext::HIV_DET_STRS[] = {
"initial", "HIVscreening", "HIVscreeningPrevDetected","HIVbackground", "HIVbackgroundPrevDetected", "presentingOI", "presentingOIPrevDetected", "linkingToTBCare", "linkingToTBCarePrevDetected", "unidentified"
};
const char *SimContext::HIV_CARE_STRS[] = {
"HIV-", "HIV+undetected", "HIV+unlinked(detected not in care)","HIV+in_care","HIV+LTFU","HIV+RTC"
};
const char *SimContext::TEST_RESULT_STRS[] = {
"truePos", "falsPos", "trueNeg", "falsNeg"
};
const char *SimContext::PEDS_HIV_STATE_STRS[] = {
"HIVposIU", "HIVposIP", "HIVposPP", "HIVneg"
};
const char *SimContext::PEDS_MATERNAL_STATUS_STRS[] = {
"negative", "HIVchr CD4 high", "HIVchr CD4 low", "HIVacut"
};
const char *SimContext::EID_TEST_TYPE_STRS[] = {
"Base Test", "First Confirmatory", "Second Confirmatory"
};
const char *SimContext::PEDS_BF_TYPE_STRS[] = {
"Exclusive Feeding", "Mixed Feeding", "Complementary Feeding", "Replacement Feeding"
};
const char *SimContext::PEDS_AGE_CAT_STRS[] = {
"0-2mth", "3-5mth", "6-8mth", "9-11mth", "12-14mth", "15-17mth", "18-23mth", "2yr", "3yr", "4yr", ">4yr"
};
const char *SimContext::PEDS_CD4_PERC_STRS[] = {
"0-5perc", "5-10perc", "10-15perc", "15-20perc", "20-25perc", "25-30perc", "30-35perc", ">35perc"
};
/* readInputs function reads in all the inputs from the given input file,
throws exception if there is an error */
void SimContext::readInputs() {
/* Open the input file for reading */
CepacUtil::changeDirectoryToInputs();
inputFile = CepacUtil::openFile(inputFileName.c_str(), "r");
if (inputFile == NULL) {
string errorString = " ERROR - Could not open input file ";
errorString.append(inputFileName);
throw errorString;
}
/* Read all the input data from the file */
readRunSpecsInputs();
readOutputInputs();
readCohortInputs();
readLTFUInputs();
readHeterogeneityInputs();
readHIVTestInputs();
readNatHistInputs();
readCHRMsInputs();
readQOLInputs();
readCostInputs();
readTreatmentInputsPart1();
readARTInputs();
readTreatmentInputsPart2();
readProphInputs();
readSTIInputs();
readTBInputs();
readPedsInputs();
readPedsProphInputs();
readPedsARTInputs();
readPedsCostInputs();
readEIDInputs();
readAdolescentInputs();
readAdolescentARTInputs();
/* Close the input file */
CepacUtil::closeFile(inputFile);
} /* end readInputs */
/* readRunSpecsInputs reads data from the RunSpecs tab of the input sheet */
void SimContext::readRunSpecsInputs() {
char buffer[256];
int i, tempBool;
// read in name of set this run belongs to
readAndSkipPast( "Runset", inputFile );
fscanf( inputFile, "%299s", buffer );
runSpecsInputs.runSetName = buffer;
// read in cohort size
readAndSkipPast( "CohortSize", inputFile );
fscanf( inputFile, "%ld", &runSpecsInputs.numCohorts );
// read in discount rate, convert to monthly rate from yearly
readAndSkipPast( "DiscFactor", inputFile );
fscanf( inputFile, "%lf", &runSpecsInputs.originalDiscRate );
runSpecsInputs.discountFactor = pow(1.0 + runSpecsInputs.originalDiscRate, 1.0 / 12.0);
// read in max actual CD4 count for patient
readAndSkipPast( "MaxPatCD4", inputFile );
fscanf( inputFile, "%lf", &runSpecsInputs.maxPatientCD4 );
// read in mth times A - C to rec ART eff
readAndSkipPast( "MthRecARTEffA", inputFile );
fscanf( inputFile, "%d", &runSpecsInputs.monthRecordARTEfficacy[0] );
readAndSkipPast( "MthRecARTEffB", inputFile );
fscanf( inputFile, "%d", &runSpecsInputs.monthRecordARTEfficacy[1] );
readAndSkipPast( "MthRecARTEffC", inputFile );
fscanf( inputFile, "%d", &runSpecsInputs.monthRecordARTEfficacy[2] );
// read in whether to use time to init rand seeds
readAndSkipPast( "RandSeedByTime", inputFile );
fscanf( inputFile, "%d", &tempBool);
runSpecsInputs.randomSeedByTime = (bool) tempBool;
// read in user locale
readAndSkipPast( "UserLocale", inputFile );
fscanf( inputFile, " %32s", buffer );
runSpecsInputs.userProgramLocale = buffer;
// read in input's internal version
readAndSkipPast( "InpVer", inputFile );
fscanf( inputFile, " %20s", buffer );
// Verify input version, throw error if it does not match up
if (strcmp(buffer, CepacUtil::CEPAC_INPUT_VERSION) != 0) {
string errorString = " ERROR - Input file version incompatible with the CEPAC executable";
throw errorString;
}
runSpecsInputs.inputVersion = buffer;
// read in the model version
readAndSkipPast( "ModelVer", inputFile );
fscanf( inputFile, " %20s", buffer );
runSpecsInputs.modelVersion = buffer;
// read in whether to model TB as an OI when the TB tab is disabled; this allows the program to apply the TB-specific OI death rate ratio
readAndSkipPast( "IncludeTB_AsOI", inputFile);
fscanf( inputFile,"%d", &tempBool );
runSpecsInputs.OIsIncludeTB = (bool) tempBool;
// read in user defined OI names, and set causes of death names
readAndSkipPast( "OIstrs", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
fscanf( inputFile, " %32s", OI_STRS[i] );
strcpy(DTH_CAUSES_STRS[i], OI_STRS[i]);
}
strcpy(DTH_CAUSES_STRS[DTH_HIV], "HIV");
strcpy(DTH_CAUSES_STRS[DTH_BKGD_MORT], "backgroundMort");
strcpy(DTH_CAUSES_STRS[DTH_ACTIVE_TB], "TB(Active)");
strcpy(DTH_CAUSES_STRS[DTH_TOX_ART], "toxART");
strcpy(DTH_CAUSES_STRS[DTH_TOX_PROPH], "toxProph");
strcpy(DTH_CAUSES_STRS[DTH_TOX_TB_PROPH], "toxTBProph");
strcpy(DTH_CAUSES_STRS[DTH_TOX_TB_TREATM], "toxTBTreatment");
strcpy(DTH_CAUSES_STRS[DTH_TOX_INFANT_HIV_PROPH], "toxInfantHIVProph");
// read in whether to output monthly cohort summaries to file
readAndSkipPast( "LongitLogCohort", inputFile );
fscanf( inputFile, "%d", &runSpecsInputs.longitLoggingLevel );
// read in OIs considered as first OIs in the log
readAndSkipPast( "LongitLogFirstOIs", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(runSpecsInputs.firstOIsLongitLogging[i]) );
// read in whether to output CD4 distribution of OI histories
readAndSkipPast( "LogPriorOIHistProb", inputFile );
fscanf( inputFile, "%d", &tempBool);
runSpecsInputs.enableOIHistoryLogging = (bool) tempBool;
// read in the number of ART failures pat has to log OI hists
readAndSkipPast( "LogOIHistwithARTfails", inputFile );
fscanf( inputFile, "%d", &runSpecsInputs.numARTFailuresForOIHistoryLogging );
// read in CD4 bounds to constrain when pat mths are included in OI hist logging
readAndSkipPast( "LogOIHistwithCD4", inputFile );
fscanf( inputFile, "%lf %lf", &(runSpecsInputs.CD4BoundsForOIHistoryLogging[LOWER_BOUND]), &(runSpecsInputs.CD4BoundsForOIHistoryLogging[UPPER_BOUND]) );
// read in HVL bnds to constrain when pat mths included in OI hist logging
readAndSkipPast( "LogOIHistwithHVL", inputFile );
fscanf( inputFile, "%d %d", &(runSpecsInputs.HVLBoundsForOIHistoryLogging[LOWER_BOUND]), &(runSpecsInputs.HVLBoundsForOIHistoryLogging[UPPER_BOUND]) );
// read in whether to excl pat mths from OI hist log if there's OI hist of given OI
readAndSkipPast( "LogOIHistExcludeOITypes", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
fscanf( inputFile, "%d", &tempBool);
runSpecsInputs.OIsToExcludeOIHistoryLogging[i] = (bool) tempBool;
}
// read in OI Fraction of Benefit
readAndSkipPast( "FOB_OIs", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(runSpecsInputs.OIsFractionOfBenefit[i]) );
// read in severe OI classification
readAndSkipPast( "Severe_OIs", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
fscanf( inputFile, "%d", &tempBool);
runSpecsInputs.severeOIs[i] = (bool) tempBool;
}
// read in CD4 count boundaries for strata
readAndSkipPast( "CD4Bounds", inputFile );
for ( i = CD4__HI; i >= CD4_VLO; i-- )
fscanf( inputFile, "%lf", &(runSpecsInputs.CD4StrataUpperBounds[i]) );
// read in whether to enable Multiple disocunt rates
readAndSkipPast( "EnableMultDiscountOutput", inputFile );
fscanf( inputFile, "%d", &tempBool );
runSpecsInputs.enableMultipleDiscountRates = (bool) tempBool;
// read in multiple discount rate, convert to monthly rate from yearly
readAndSkipPast( "DiscountRatesCost", inputFile );
for (i = 0; i < NUM_DISCOUNT_RATES; i++){
double annualDiscountRate;
fscanf( inputFile, "%lf", &annualDiscountRate);
runSpecsInputs.multDiscountRatesCost[i] = pow(1.0+annualDiscountRate, 1.0/12.0);
}
// read in multiple discount rate, convert to monthly rate from yearly
readAndSkipPast( "DiscountRatesBenefit", inputFile );
for (i = 0; i < NUM_DISCOUNT_RATES; i++){
double annualDiscountRate;
fscanf( inputFile, "%lf", &annualDiscountRate);
runSpecsInputs.multDiscountRatesBenefit[i] = pow(1.0+annualDiscountRate, 1.0/12.0);
}
} /* end readRunSpecsInputs */
/* readOutputInputs reads data from the Output tab of the input sheet */
void SimContext::readOutputInputs() {
int i, tempBool;
readAndSkipPast("NumPatientsToTrace", inputFile);
fscanf(inputFile, "%d", &(outputInputs.traceNumSelection));
numPatientsToTrace = min(outputInputs.traceNumSelection, numPatientsToTrace);
//read in sub cohort parameters
readAndSkipPast("EnableSubCohorts", inputFile);
fscanf(inputFile, "%d", &tempBool);
outputInputs.enableSubCohorts = (bool) tempBool;
readAndSkipPast("SubCohortValues", inputFile);
for (i = 0; i < MAX_NUM_SUBCOHORTS; i++)
fscanf(inputFile, "%ld", &(outputInputs.subCohorts[i]));
//read in cost output parameters
readAndSkipPast("EnableDetailedCosts", inputFile);
fscanf(inputFile, "%d", &tempBool);
outputInputs.enableDetailedCostOutputs = (bool) tempBool;
}
/* readCohortInputs reads data from the Cohort tab of the input sheet */
void SimContext::readCohortInputs() {
int i, j, k, tempInt, tempBool;
double dTemp;
char scratch[256];
// read in popul initial CD4 distrib
readAndSkipPast( "InitCD4", inputFile );
fscanf(inputFile,"%lf %lf", &(cohortInputs.initialCD4Mean), &(cohortInputs.initialCD4StdDev));
readAndSkipPast("UseSqRtTransform", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.enableSquareRootTransform = (bool) tempBool;
// read in popul initial HVL distrib
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j ) {
readAndSkipPast( "InitHVL", inputFile );
readAndSkipPast( CD4_STRATA_STRS[j], inputFile );
for ( i = HVL_NUM_STRATA - 1; i >= HVL_VLO; --i )
fscanf( inputFile, "%lf", &(cohortInputs.initialHVLDistribution[j][i]) );
}
// read in popul initial age (mths) distrib
readAndSkipPast( "InitAge", inputFile );
fscanf(inputFile,"%lf %lf", &cohortInputs.initialAgeMean, &cohortInputs.initialAgeStdDev);
// read in custom age dist bool
readAndSkipPast( "InitAgeCustomDist", inputFile );
fscanf(inputFile, "%d", &tempBool);
cohortInputs.useCustomAgeDist = (bool) tempBool;
// store age dist strata mins/maxes in same array!
readAndSkipPast( "AgeStratMins", inputFile );
for (i = 0; i < INIT_AGE_NUM_STRATA; ++i) {
fscanf(inputFile, "%lf", &cohortInputs.ageStrata[i] );
}
readAndSkipPast( "AgeStratMaxes", inputFile );
for (i = 0; i < INIT_AGE_NUM_STRATA; ++i) {
fscanf(inputFile, "%lf", &cohortInputs.ageStrata[INIT_AGE_NUM_STRATA + i] );
}
// read in age strata probabilites as CDF
readAndSkipPast( "AgeStratProbs", inputFile );
for (i = 0; i < INIT_AGE_NUM_STRATA; ++i) {
fscanf(inputFile, "%lf", &cohortInputs.ageProbs[i]);
if (i > 0)
cohortInputs.ageProbs[i] += cohortInputs.ageProbs[i - 1];
}
// read in male percentage of cohort
readAndSkipPast( "InitGender", inputFile );
fscanf( inputFile, "%lf", &cohortInputs.maleGenderDistribution );
// read in OI proph noncompliance prob and degree
readAndSkipPast( "ProphNonCompliance", inputFile );
fscanf( inputFile, "%lf %lf", &cohortInputs.OIProphNonComplianceRisk, &cohortInputs.OIProphNonComplianceDegree );
// read in distribution of clinic visit patient types
readAndSkipPast( "PatClinicTypes", inputFile );
dTemp = 1.0;
for ( i = 0; i < CLINIC_VISITS_NUM - 1; ++i ) {
fscanf( inputFile, "%lf", &(cohortInputs.clinicVisitTypeDistribution[i]) );
dTemp -= cohortInputs.clinicVisitTypeDistribution[i];
}
cohortInputs.clinicVisitTypeDistribution[CLINIC_VISITS_NUM - 1] = dTemp;
// read in distribution of proph and ART implement patient types
readAndSkipPast( "PatTreatmentTypes", inputFile );
dTemp = 1.0;
for ( i = 0; i < THERAPY_IMPL_NUM - 1; ++i ) {
fscanf( inputFile, "%lf", &(cohortInputs.therapyImplementationDistribution[i]) );
dTemp -= cohortInputs.therapyImplementationDistribution[i];
}
cohortInputs.therapyImplementationDistribution[THERAPY_IMPL_NUM - 1] = dTemp;
// read in distribution of CD4 response types on ART
readAndSkipPast("PatCD4ResponeTypeOnART", inputFile);
dTemp = 1.0;
for (i = 0; i < CD4_RESPONSE_NUM_TYPES - 1; i++) {
fscanf(inputFile, "%lf", &(cohortInputs.CD4ResponseTypeOnARTDistribution[i]));
dTemp -= cohortInputs.CD4ResponseTypeOnARTDistribution[i];
}
cohortInputs.CD4ResponseTypeOnARTDistribution[CD4_RESPONSE_NUM_TYPES - 1] = dTemp;
// read in popul prob of prev OI histories
readAndSkipPast( "PriorOIHistAtEntry", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
readAndSkipPast( OI_STRS[i], inputFile );
for ( k = HVL_NUM_STRATA - 1; k >= 0; --k ) {
readAndSkipPast( HVL_STRATA_STRS[k], inputFile );
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j )
fscanf( inputFile, "%lf", &(cohortInputs.probOIHistoryAtEntry[j][k][i]) );
}
}
// read in prevalence and incidence of generic risk factors, along with string labels for them
readAndSkipPast("ProbRiskFactorPrev", inputFile);
for (int i = 0; i < RISK_FACT_NUM; i++) {
fscanf(inputFile, "%lf ", &(cohortInputs.probRiskFactorPrev[i]));
}
readAndSkipPast("ProbRiskFactorIncid", inputFile);
for (int i = 0; i < RISK_FACT_NUM; i++) {
fscanf(inputFile, "%lf ", &(cohortInputs.probRiskFactorIncid[i]));
}
readAndSkipPast( "GenRiskFactorStrs", inputFile);
for (int i = 0; i < RISK_FACT_NUM; i++) {
fscanf( inputFile, "%32s", RISK_FACT_STRS[i] );
strcpy(DTH_CAUSES_STRS[DTH_RISK_1 + i], RISK_FACT_STRS[i]);
}
//Read in transmission inputs
readAndSkipPast("ShowTransmissionOutput", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.showTransmissionOutput = (bool) tempBool;
for ( k = HVL_NUM_STRATA - 1; k >= 0; --k ) {
readAndSkipPast2( "TransmissionRateOnART", HVL_STRATA_STRS[k], inputFile );
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j )
fscanf( inputFile, "%lf", &(cohortInputs.transmRateOnART[j][k]) );
}
readAndSkipPast2( "TransmissionRateOnART", "Acute", inputFile );
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j )
fscanf( inputFile, "%lf", &(cohortInputs.transmRateOnARTAcute[j]) );
for ( k = HVL_NUM_STRATA - 1; k >= 0; --k ) {
readAndSkipPast2( "TransmissionRateOffART", HVL_STRATA_STRS[k], inputFile );
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j )
fscanf( inputFile, "%lf", &(cohortInputs.transmRateOffART[j][k]) );
}
readAndSkipPast2( "TransmissionRateOffART", "Acute", inputFile );
for ( j = CD4_NUM_STRATA - 1; j >= 0; --j )
fscanf( inputFile, "%lf", &(cohortInputs.transmRateOffARTAcute[j]) );
readAndSkipPast("TransmissionUseHIVTestAcuteDef", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.transmUseHIVTestAcuteDefinition = (bool) tempBool;
readAndSkipPast("TransmissionAcuteDuration", inputFile);
fscanf(inputFile, "%d", &(cohortInputs.transmAcuteDuration));
readAndSkipPast("IntvlTransmissionRateMultiplier", inputFile);
for (i = 0; i < 2; i++)
fscanf(inputFile, "%d", &(cohortInputs.transmRateMultInterval[i]));
readAndSkipPast("TransmissionRateMultiplier", inputFile);
for (i = 0; i < 3; i++)
fscanf(inputFile, "%lf", &(cohortInputs.transmRateMult[i]));
for ( i = 0; i < TRANSM_RISK_NUM; i++){
readAndSkipPast2("TransmissionRiskDistribution", TRANSM_RISK_STRS[i], inputFile);
for (j = 0; j < TRANSM_RISK_AGE_NUM; j++){
fscanf(inputFile, "%lf", &(cohortInputs.transmRiskDistrib[GENDER_MALE][j][i]));
}
for (j = 0; j < TRANSM_RISK_AGE_NUM; j++){
fscanf(inputFile, "%lf", &(cohortInputs.transmRiskDistrib[GENDER_FEMALE][j][i]));
}
}
readAndSkipPast("TransmissionRiskMultiplierBounds", inputFile);
for ( i = 0; i < 2; i++){
fscanf( inputFile, "%d", &(cohortInputs.transmRiskMultBounds[i]));
}
for (i = 0; i < 3; i++){
sprintf(scratch, "TransmissionRiskMultiplier_T%d", i + 1);
readAndSkipPast(scratch, inputFile);
for ( j = 0; j < TRANSM_RISK_NUM; j++){
fscanf( inputFile, "%lf", &(cohortInputs.transmRiskMult[j][i]));
}
}
readAndSkipPast("UseDynamicTransmission", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.useDynamicTransm = (bool) tempBool;
cohortInputs.updateDynamicTransmInc = true;
readAndSkipPast("DynamicTransmissionNumTransmissionsHRG", inputFile);
fscanf(inputFile, "%lf", &(cohortInputs.dynamicTransmHRGTransmissions));
readAndSkipPast("DynamicTransmissionPropHRGAttrib", inputFile);
fscanf(inputFile, "%lf", &(cohortInputs.dynamicTransmPropHRGAttributable));
readAndSkipPast("DynamicTransmissionNumHIVPosHRG", inputFile);
fscanf(inputFile, "%lf", &(cohortInputs.dynamicTransmNumHIVPosHRG));
readAndSkipPast("DynamicTransmissionNumHIVNegHRG", inputFile);
fscanf(inputFile, "%lf", &(cohortInputs.dynamicTransmNumHIVNegHRG));
readAndSkipPast("DynamicTransmissionWarmupSize", inputFile);
fscanf(inputFile, "%d", &(cohortInputs.dynamicTransmWarmupSize));
readAndSkipPast("DynamicTransmissionKeepPrEPAfterWarmup", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.keepPrEPAfterWarmup = (bool) tempBool;
readAndSkipPast("DynamicTransmissionUsePrEPDuringWarmup", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.usePrEPDuringWarmup = (bool) tempBool;
readAndSkipPast("TransmissionUseEndLifeHVLAdjust", inputFile);
fscanf(inputFile, "%d", &tempBool);
cohortInputs.useTransmEndLifeHVLAdjustment = (bool) tempBool;
readAndSkipPast("TransmissionEndLifeAdjustCD4Threshold", inputFile);
fscanf(inputFile, "%lf", &(cohortInputs.transmEndLifeHVLAdjustmentCD4Threshold));
readAndSkipPast("TransmissionEndLifeAdjustARTLineThreshold", inputFile);
fscanf(inputFile, "%d", &tempInt);
cohortInputs.transmEndLifeHVLAdjustmentARTLineThreshold = tempInt - 1;
} /* end readCohortInputs */
/* readTreatmentInputsPart1 reads data from the Treatment tab of the input sheet,
split in the middle for the reading of ARTs tab */
void SimContext::readTreatmentInputsPart1() {
int i, j, tempBool;
// read in clinic visit interval
readAndSkipPast( "IntvlClinicVisit", inputFile );
fscanf( inputFile, "%d", &(treatmentInputs.clinicVisitInterval) );
// read in probabilities of detecting patient's prior OI history
readAndSkipPast( "ProbDetOI_Entry", inputFile );
for ( j = 0; j < OI_NUM; ++j )
fscanf( inputFile, "%lf", &(treatmentInputs.probDetectOIAtEntry[j]) );
readAndSkipPast( "ProbDetOI_LastVst", inputFile );
for ( j = 0; j < OI_NUM; ++j )
fscanf( inputFile, "%lf", &(treatmentInputs.probDetectOISinceLastVisit[j]) );
// read in probabilities of switching to secondary proph at OI event
readAndSkipPast( "ProbSwitchSecProph", inputFile );
for ( j = 0; j < OI_NUM; ++j )
fscanf( inputFile, "%lf", &(treatmentInputs.probSwitchSecondaryProph[j]) );
// read in CD4 and on ART months thresholds used for testing frequency
readAndSkipPast( "IntvlCD4Tst_CD4Threshold", inputFile );
fscanf( inputFile, "%lf", &treatmentInputs.testingIntervalCD4Threshold );
readAndSkipPast("IntvlCD4Tst_MonthsThreshold", inputFile);
fscanf( inputFile, "%d %d", &treatmentInputs.testingIntervalARTMonthsThreshold,
&treatmentInputs.testingIntervalLastARTMonthsThreshold);
// read in CD4/HVL test intervals
readAndSkipPast( "IntvlCD4Tst", inputFile );
fscanf( inputFile, "%d %d %d %d %d %d %d",
&treatmentInputs.CD4TestingIntervalPreARTHighCD4, &treatmentInputs.CD4TestingIntervalPreARTLowCD4,
&treatmentInputs.CD4TestingIntervalOnART[0], &treatmentInputs.CD4TestingIntervalOnART[1],
&treatmentInputs.CD4TestingIntervalOnLastART[0], &treatmentInputs.CD4TestingIntervalOnLastART[1],
&treatmentInputs.CD4TestingIntervalPostART);
readAndSkipPast( "IntvlHVLTst", inputFile );
fscanf( inputFile, "%d %d %d %d %d %d %d",
&treatmentInputs.HVLTestingIntervalPreARTHighCD4, &treatmentInputs.HVLTestingIntervalPreARTLowCD4,
&treatmentInputs.HVLTestingIntervalOnART[0], &treatmentInputs.HVLTestingIntervalOnART[1],
&treatmentInputs.HVLTestingIntervalOnLastART[0], &treatmentInputs.HVLTestingIntervalOnLastART[1],
&treatmentInputs.HVLTestingIntervalPostART );
// read in HVL test err prob (lower & higher)
readAndSkipPast( "HVLtestErrProb", inputFile );
fscanf( inputFile, "%lf %lf", &treatmentInputs.probHVLTestErrorHigher, &treatmentInputs.probHVLTestErrorLower );
// read in CD4 test err deviation and bias
readAndSkipPast( "CD4testErrSDev", inputFile );
fscanf( inputFile, "%lf", &treatmentInputs.CD4TestStdDevPercentage );
readAndSkipPast( "CD4testBiasMean", inputFile );
fscanf( inputFile, "%lf", &treatmentInputs.CD4TestBiasMean );
readAndSkipPast( "CD4testBiasSdev", inputFile );
fscanf( inputFile, "%lf", &treatmentInputs.CD4TestBiasStdDevPercentage );
// read in whether to perform ART obsv fail CD4/HVL tests outside clinic visit
readAndSkipPast( "ObsvARTFailTestOnRegClinicVst", inputFile );
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.ARTFailureOnlyAtRegularVisit = (bool) tempBool;
// read in numbers of CD4/HVL tests outside clinic visit at ART initiation
readAndSkipPast( "ARTInitHVLTestsWOClinicVst", inputFile );
fscanf( inputFile, "%d", &treatmentInputs.numARTInitialHVLTests );
readAndSkipPast( "ARTInitCD4TestsWOClinicVst", inputFile );
fscanf( inputFile, "%d", &treatmentInputs.numARTInitialCD4Tests );
// read in if OI visits are not treated as regular clinic visits
readAndSkipPast( "OIVstAsNotSchedClinicVst", inputFile );
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.emergencyVisitIsNotRegularVisit = (bool) tempBool;
// read in months to lag of cd4/hvl testing availability
readAndSkipPast( "LagToCD4Test", inputFile );
fscanf( inputFile, "%d", &treatmentInputs.CD4TestingLag );
readAndSkipPast( "LagToHVLTest", inputFile );
fscanf( inputFile, "%d", &treatmentInputs.HVLTestingLag );
//read in criteria to end CD4 monitoring for this line of ART
readAndSkipPast( "StopCD4MonitoringEnable", inputFile );
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.cd4MonitoringStopEnable = (bool) tempBool;
readAndSkipPast( "StopCD4MonitoringThreshold", inputFile );
fscanf( inputFile, "%lf", &treatmentInputs.cd4MonitoringStopThreshold );
readAndSkipPast( "StopCD4MonitoringMthsPostARTInit", inputFile );
fscanf( inputFile, "%d", &treatmentInputs.cd4MonitoringStopMthsPostARTInit );
//ART starting criteria
// read in CD4 bounds
readAndSkipPast2( "ARTstart_CD4", "upp", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsOnly[UPPER_BOUND]) );
readAndSkipPast2( "ARTstart_CD4", "lwr", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsOnly[LOWER_BOUND]) );
// read in HVL bounds to administer ARTs
readAndSkipPast2( "ARTstart_HVL", "upp", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].HVLBoundsOnly[UPPER_BOUND]) );
readAndSkipPast2( "ARTstart_HVL", "lwr", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].HVLBoundsOnly[LOWER_BOUND]) );
// read in CD4 & HVL bounds to administer ARTs
readAndSkipPast2( "ARTstart_CD4HVL", "CD4upp", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsWithHVL[UPPER_BOUND]) );
readAndSkipPast2( "ARTstart_CD4HVL", "CD4lwr", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsWithHVL[LOWER_BOUND]) );
readAndSkipPast2( "ARTstart_CD4HVL", "HVLupp", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].HVLBoundsWithCD4[UPPER_BOUND]) );
readAndSkipPast2( "ARTstart_CD4HVL", "HVLlwr", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].HVLBoundsWithCD4[LOWER_BOUND]) );
// read in OI criteria to administer ARTs
for (j = 0; j < OI_NUM; ++j) {
readAndSkipPast2( "ARTstart_OIs", OI_STRS[j], inputFile );
for (i = 0; i < ART_NUM_LINES; ++i) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.startART[i].OIHistory[j] = (bool) tempBool;
}
}
readAndSkipPast2( "ARTstart_OIs", "numOIs", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].numOIs) );
// read in CD4 & OI criteria to administer ARTs
readAndSkipPast2( "ARTstart_CD4OI", "CD4upp", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsWithOIs[UPPER_BOUND]) );
readAndSkipPast2( "ARTstart_CD4OI", "CD4lwr", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%lf", &(treatmentInputs.startART[i].CD4BoundsWithOIs[LOWER_BOUND]) );
for (j = 0; j < OI_NUM; ++j) {
readAndSkipPast2( "ARTstart_CD4OI", OI_STRS[j], inputFile );
for (i = 0; i < ART_NUM_LINES; ++i) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.startART[i].OIHistoryWithCD4[j] = (bool) tempBool;
}
}
readAndSkipPast2( "ARTstart", "obsvFailFPSuppression", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i){
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.startART[i].ensureSuppFalsePositiveFailure = (bool) tempBool;
}
// read in minimum/maximum mth # to start ART
readAndSkipPast2( "ARTstart", "minMthNum", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].minMonthNum) );
readAndSkipPast2( "ARTstart", "maxMthNum", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].maxMonthNum) );
readAndSkipPast2( "ARTstart", "MthsSincePrevRegStop", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i)
fscanf( inputFile, "%d", &(treatmentInputs.startART[i].monthsSincePrevRegimen) );
} /* endReadTreatmentInputsPart1 */
/* readTreatmentInputsPart2 reads data from the second half of the Treatment tab of the input sheet, split in the middle for the reading of ARTs tab */
void SimContext::readTreatmentInputsPart2() {
int i, j, tempBool, tempInt;
char buffer[256];
// read in whether to enable interruption of ART
readAndSkipPast( "EnableSTIforART", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.enableSTIForART[i] = (bool) tempBool;
}
// ART Failure parameters
// read in # HVL lvls to incr for fail diag
readAndSkipPast( "ARTfail_hvlNumIncr", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].HVLNumIncrease) );
// read in absolute HVL counts for fail diag
readAndSkipPast( "ARTfail_hvlAbsol", inputFile );
readAndSkipPast( "uppBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].HVLBounds[UPPER_BOUND]) );
readAndSkipPast( "ARTfail_hvlAbsol", inputFile );
readAndSkipPast( "lwrBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].HVLBounds[LOWER_BOUND]) );
// read in true/false use HVL as setpoint for fail diag
readAndSkipPast( "ARTfail_hvlAtSetptAsFailDiag", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.failART[i].HVLFailAtSetpoint = (bool) tempBool;
}
// read in # of months before using HVL criteria
readAndSkipPast( "ARTfail_hvlMthsFromInit", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].HVLMonthsFromInit) );
// read in CD4 percentage to decr for fail diag
readAndSkipPast( "ARTfail_cd4PercDrop", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.failART[i].CD4PercentageDrop) );
// read in true/false use CD4 as below pre-ART nadir for fail diag
readAndSkipPast( "ARTfail_cd4BelowPreARTNadir", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.failART[i].CD4BelowPreARTNadir = (bool) tempBool;
}
// read in absolute CD4 counts as OR criteria for fail diag
readAndSkipPast( "ARTfail_cd4AbsolOR", inputFile );
readAndSkipPast( "uppBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.failART[i].CD4BoundsOR[UPPER_BOUND]) );
readAndSkipPast( "ARTfail_cd4AbsolOR", inputFile );
readAndSkipPast( "lwrBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.failART[i].CD4BoundsOR[LOWER_BOUND]) );
// read in absolute CD4 counts as AND criteria for fail diag
readAndSkipPast( "ARTfail_cd4AbsolAND", inputFile );
readAndSkipPast( "uppBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.failART[i].CD4BoundsAND[UPPER_BOUND]) );
readAndSkipPast( "ARTfail_cd4AbsolAND", inputFile );
readAndSkipPast( "lwrBnd", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.failART[i].CD4BoundsAND[LOWER_BOUND]) );
// read in # of months before using CD4 criteria
readAndSkipPast( "ARTfail_cd4MthsFromInit", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].CD4MonthsFromInit) );
// read in whether to treat OI event as ART fail diag
for ( j = 0; j < OI_NUM; ++j ) {
readAndSkipPast( "ARTfail_OIs", inputFile );
readAndSkipPast( OI_STRS[j], inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ){
fscanf( inputFile, "%d", &tempInt);
treatmentInputs.failART[i].OIsEvent[j] = (ART_FAIL_BY_OI) tempInt;
}
}
readAndSkipPast( "ARTfail_OIsMinNum", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].OIsMinNum) );
readAndSkipPast( "ARTfail_OIsMthsFromInit", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].OIsMonthsFromInit) );
// read in ART failure diagnoses criteria parameters
readAndSkipPast( "ARTfail_diagNumTestsFail", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].diagnoseNumTestsFail) );
readAndSkipPast( "ARTfail_diagUseHVLTestsConfirm", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.failART[i].diagnoseUseHVLTestsConfirm = (bool) tempBool;
}
readAndSkipPast( "ARTfail_diagUseCD4TestsConfirm", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.failART[i].diagnoseUseCD4TestsConfirm = (bool) tempBool;
}
readAndSkipPast( "ARTfail_diagNumTestsConfirm", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.failART[i].diagnoseNumTestsConfirm) );
//read in ART stopping policy
// read in maximum number of months to be on ART
readAndSkipPast( "ARTstop_MaxMthsOnART", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopART[i].maxMonthsOnART));
// read in stop on major toxicity
readAndSkipPast("ARTstop_MajorToxicity", inputFile);
for (i = 0; i < ART_NUM_LINES; i++) {
fscanf(inputFile, "%d", &tempBool);
treatmentInputs.stopART[i].withMajorToxicty = (bool) tempBool;
}
// read in criteria to use after failure has been observed
readAndSkipPast( "ARTstop_OnFailImmed", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.stopART[i].afterFailImmediate = (bool) tempBool;
}
readAndSkipPast( "ARTstop_OnFailBelowCD4", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopART[i].afterFailCD4LowerBound));
readAndSkipPast( "ARTstop_OnFailSevereOI", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.stopART[i].afterFailWithSevereOI = (bool) tempBool;
}
readAndSkipPast( "ARTstop_OnFailMthsAfterObsv", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopART[i].afterFailMonthsFromObserved));
// read in minimum month number to stop ART
readAndSkipPast( "ARTstop_OnFailMinMthNum", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopART[i].afterFailMinMonthNum) );
readAndSkipPast( "ARTstop_OnFailMthsFromInit", inputFile );
for ( i = 0; i < ART_NUM_LINES; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopART[i].afterFailMonthsFromInit) );
//Read in next line if stopping for major tox
readAndSkipPast( "ARTStopMajorToxNextLine", inputFile );
for (i = 0; i < ART_NUM_LINES; ++i){
fscanf( inputFile, "%d", &tempInt);
if (tempInt != NOT_APPL)
tempInt--;
treatmentInputs.stopART[i].nextLineAfterMajorTox = tempInt;
}
// read in ART resistance penalty parameters
for (i = 0; i < ART_NUM_LINES; i++) {
sprintf(buffer, "reg_%d", i + 1);
readAndSkipPast2("ARTresistRed_initSucc", buffer, inputFile);
for (j = 0; j < ART_NUM_LINES; j++) {
fscanf(inputFile, "%lf", &(treatmentInputs.ARTResistancePriorRegimen[i][j]));
}
}
readAndSkipPast( "ARTresistRed_HVL", inputFile );
for (i = HVL_NUM_STRATA - 1; i >= 0; --i) {
fscanf(inputFile, "%lf", &(treatmentInputs.ARTResistanceHVL[i]));
}
// read in primary OI proph regimen starting criteria
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "boolFlag", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.startProph[PROPH_PRIMARY][i].useOrEvaluation = (bool) tempBool;
}
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "curCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_PRIMARY][i].currCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "curCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_PRIMARY][i].currCD4Bounds[LOWER_BOUND]) );
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "minCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_PRIMARY][i].minCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "minCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_PRIMARY][i].minCD4Bounds[LOWER_BOUND]) );
for ( j = 0; j < OI_NUM; ++j ) {
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( OI_STRS[j], inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.startProph[PROPH_PRIMARY][i].OIHistory[j]) );
}
readAndSkipPast( "PriProphStart", inputFile );
readAndSkipPast( "minMthNum", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.startProph[PROPH_PRIMARY][i].minMonthNum) );
// read in primary OI proph regimen stopping criteria
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "boolFlag", inputFile );
for ( i = 0; i < OI_NUM; ++i ) {
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.stopProph[PROPH_PRIMARY][i].useOrEvaluation = (bool) tempBool;
}
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "curCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].currCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "curCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].currCD4Bounds[LOWER_BOUND]) );
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "minCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].minCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "minCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].minCD4Bounds[LOWER_BOUND]) );
for ( j = 0; j < OI_NUM; ++j ) {
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( OI_STRS[j], inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].OIHistory[j]) );
}
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "minMthNum", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].minMonthNum) );
readAndSkipPast( "PriProphStop", inputFile );
readAndSkipPast( "mthsOnProph", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.stopProph[PROPH_PRIMARY][i].monthsOnProph) );
// read in secondart OI proph regimen starting criteria
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "boolFlag", inputFile );
for ( i = 0; i < OI_NUM; ++i ){
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.startProph[PROPH_SECONDARY][i].useOrEvaluation = (bool) tempBool;
}
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "curCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_SECONDARY][i].currCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "curCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_SECONDARY][i].currCD4Bounds[LOWER_BOUND]) );
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "minCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_SECONDARY][i].minCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "minCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.startProph[PROPH_SECONDARY][i].minCD4Bounds[LOWER_BOUND]) );
for ( j = 0; j < OI_NUM; ++j ) {
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( OI_STRS[j], inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.startProph[PROPH_SECONDARY][i].OIHistory[j]) );
}
readAndSkipPast( "SecProphStart", inputFile );
readAndSkipPast( "minMthNum", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%d", &(treatmentInputs.startProph[PROPH_SECONDARY][i].minMonthNum) );
// read in secondary OI proph regimen stopping criteria
readAndSkipPast( "SecProphStop", inputFile );
readAndSkipPast( "boolFlag", inputFile );
for ( i = 0; i < OI_NUM; ++i ){
fscanf( inputFile, "%d", &tempBool);
treatmentInputs.stopProph[PROPH_SECONDARY][i].useOrEvaluation = (bool) tempBool;
}
readAndSkipPast( "SecProphStop", inputFile );
readAndSkipPast( "curCD4upp", inputFile );
for ( i = 0; i < OI_NUM; ++i )
fscanf( inputFile, "%lf", &(treatmentInputs.stopProph[PROPH_SECONDARY][i].currCD4Bounds[UPPER_BOUND]) );
readAndSkipPast( "SecProphStop", inputFile );
readAndSkipPast( "curCD4lwr", inputFile );
for ( i = 0; i < OI_NUM; ++i )