Skip to content

Commit 8a3c5d8

Browse files
author
Grahame Grieve
committed
improved expansion diagnostics
1 parent 2977bd6 commit 8a3c5d8

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

library/fhir/fhir_tx.pas

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ procedure TTerminologyOperationContext.log(note: String);
335335
var
336336
s : string;
337337
begin
338-
s := DescribePeriodMS(GetTickCount64 - FStartTime)+' '+note;
338+
s := inttostr(GetTickCount64 - FStartTime)+'ms '+note;
339339
if UnderDebugger then
340340
Logging.log(s);
341341
FTimeTracker.step(s);
@@ -345,7 +345,7 @@ procedure TTerminologyOperationContext.addNote(vs : TFHIRValueSetW; note : Strin
345345
var
346346
s : string;
347347
begin
348-
s := DescribePeriodMS(GetTickCount64 - FStartTime)+' '+vs.vurl+': '+note;
348+
s := inttostr(GetTickCount64 - FStartTime)+'ms '+vs.vurl+': '+note;
349349
if UnderDebugger then
350350
Logging.log(s);
351351
FTimeTracker.step(s);

library/ftx/fhir_valuesets.pas

+12
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
35033503
begin
35043504
//Logging.log('Processing '+vsId+', import value set '+s);
35053505
deadCheck('processCodes#2');
3506+
FOpContext.log('import value set '+s);
35063507
ivs := TFHIRImportedValueSet.create(expandValueset(s, '', filter.filter, dependencies, notClosed));
35073508
try
35083509
checkCanonicalStatus(expansion, ivs.FValueSet, FValueSet);
@@ -3535,6 +3536,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
35353536
//Logging.log(' ...import value set '+s);
35363537
deadCheck('processCodes#3');
35373538
f := nil;
3539+
FOpContext.log('import2 value set '+s);
35383540
// if we can, we can do a short cut evaluation that means we don't have to do a full expansion of the source value set.
35393541
// this saves lots of overhead we don't need. But it does require simple cases (though they are common). So we have a look
35403542
// at the value set, and see whether we can short cut it. If we can, it's just another filter (though we can't iterate on it)
@@ -3555,6 +3557,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
35553557
begin
35563558
if (cs.SpecialEnumeration <> '') and FParams.limitedExpansion and filters.Empty then
35573559
begin
3560+
FOpContext.log('import special value set '+s);
35583561
base := expandValueSet(cs.SpecialEnumeration, '', filter.filter, dependencies, notClosed);
35593562
try
35603563
expansion.addExtensionV('http://hl7.org/fhir/StructureDefinition/valueset-toocostly', FFactory.makeBoolean(true));
@@ -3566,6 +3569,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
35663569
end
35673570
else if filter.Null then // special case - add all the code system
35683571
begin
3572+
FOpContext.log('add whole code system');
35693573
if cs.isNotClosed(FOpContext, filter) then
35703574
if cs.SpecialEnumeration <> '' then
35713575
raise costDiags(ETooCostly.create('The code System "'+cs.systemUri+'" has a grammar, and cannot be enumerated directly. If an incomplete expansion is requested, a limited enumeration will be returned'))
@@ -3595,6 +3599,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
35953599
end
35963600
else
35973601
begin
3602+
FOpContext.log('prepare filters');
35983603
NoTotal;
35993604
if cs.isNotClosed(FOpContext, filter) then
36003605
notClosed := true;
@@ -3603,6 +3608,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
36033608
ctxt := cs.searchFilter(FOpContext, filter, prep, false);
36043609
try
36053610
cs.prepare(FOpContext, prep);
3611+
FOpContext.log('iterate filters');
36063612
while cs.FilterMore(FOpContext, ctxt) do
36073613
begin
36083614
deadCheck('processCodes#4');
@@ -3623,6 +3629,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
36233629
c.free;
36243630
end;
36253631
end;
3632+
FOpContext.log('iterate filters done');
36263633
finally
36273634
ctxt.free;
36283635
end;
@@ -3634,6 +3641,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
36343641

36353642
if (cset.hasConcepts) then
36363643
begin
3644+
FOpContext.log('iterate concepts');
36373645
cds := TConceptDesignations.Create(FFactory.link, FLanguages.link);
36383646
try
36393647
tcount := 0;
@@ -3666,10 +3674,12 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
36663674
finally
36673675
cds.free;
36683676
end;
3677+
FOpContext.log('iterate concepts done');
36693678
end;
36703679

36713680
if cset.hasFilters then
36723681
begin
3682+
FOpContext.log('prepare filters');
36733683
fcl := cset.filters;
36743684
try
36753685
prep := cs.getPrepContext(FOpContext);
@@ -3706,6 +3716,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
37063716

37073717
inner := cs.prepare(FOpContext, prep);
37083718
count := 0;
3719+
FOpContext.log('iterate filters');
37093720
While cs.FilterMore(FOpContext, filters[0]) do
37103721
begin
37113722
deadCheck('processCodes#5');
@@ -3742,6 +3753,7 @@ procedure TFHIRValueSetExpander.includeCodes(cset: TFhirValueSetComposeIncludeW;
37423753
finally
37433754
prep.free;
37443755
end;
3756+
FOpContext.log('iterate filters done');
37453757
finally
37463758
fcl.free;
37473759
end;

library/ftx/ftx_loinc_services.pas

+2-2
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,9 @@ function TLOINCServices.filterBySQL(opContext : TTxOperationContext; c : TFDBCon
10421042
end;
10431043
c.terminate;
10441044
t := GetTickCount64-t;
1045-
opContext.log('LOINC filter: '+inttostr(l)+' rows for '+d+' ('+DescribePeriodMS(t)+', sql = '+sql+')');
1045+
opContext.log('LOINC filter: '+inttostr(l)+' rows for '+d+' ('+inttostr(t)+'ms)');
10461046
if (UnderDebugger) or (t > 1000) then
1047-
Logging.log('LOINC filter: '+inttostr(l)+' rows for '+d+' ('+DescribePeriodMS(t)+', sql = '+sql+')');
1047+
Logging.log('LOINC filter: '+inttostr(l)+' rows for '+d+' ('+inttostr(t)+'ms, sql = '+sql+')');
10481048
end;
10491049
SetLength(keys, l);
10501050
result := TLoincFilterHolder.create;

0 commit comments

Comments
 (0)