Skip to content

Commit

Permalink
Merge branch 'HealthIntersections:master' into linux-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
costateixeira committed Sep 24, 2024
2 parents 6936f03 + 25c68bc commit 6aa4f6a
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 43 deletions.
8 changes: 4 additions & 4 deletions install/install-tk.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
; AppID can never be changed as subsequent installations require the same installation ID each time
AppID=FHIRToolkit
AppName=Health Intersections FHIR Toolkit
AppVerName=FHIRToolkit v3.4.13
AppVerName=FHIRToolkit v3.4.15

; compilation control
OutputDir=..\install\build
OutputBaseFilename=fhirtoolkit-win64-3.4.13
OutputBaseFilename=fhirtoolkit-win64-3.4.15
Compression=lzma2/ultra64

; 64 bit
Expand All @@ -32,11 +32,11 @@ UninstallFilesDir={app}\uninstall
; win2000+ add/remove programs support
AppPublisher=Health Intersections P/L
AppPublisherURL=http://www.healthintersections.com.au
AppVersion=3.4.13
AppVersion=3.4.15
AppSupportURL=https://github.com/grahamegrieve/fhirserver
AppUpdatesURL=https://github.com/grahamegrieve/fhirserver
AppCopyright=Copyright (c) Health Intersections Pty Ltd 2020+
VersionInfoVersion=3.4.13.0
VersionInfoVersion=3.4.15.0

; dialog support
LicenseFile=..\license
Expand Down
8 changes: 4 additions & 4 deletions install/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
; AppID can never be changed as subsequent installations require the same installation ID each time
AppID=FHIRServer
AppName=Health Intersections FHIR Server
AppVerName=FHIRServer v3.4.13
AppVerName=FHIRServer v3.4.15

; compilation control
OutputDir=..\install\build
OutputBaseFilename=fhirserver-win64-3.4.13
OutputBaseFilename=fhirserver-win64-3.4.15
Compression=lzma2/ultra64

; 64 bit
Expand All @@ -34,11 +34,11 @@ UninstallFilesDir={app}\uninstall
; win2000+ add/remove programs support
AppPublisher=Health Intersections P/L
AppPublisherURL=http://www.healthintersections.com.au
AppVersion=3.4.13
AppVersion=3.4.15
AppSupportURL=https://github.com/grahamegrieve/fhirserver
AppUpdatesURL=https://github.com/grahamegrieve/fhirserver
AppCopyright=Copyright (c) Health Intersections Pty Ltd 2011+
VersionInfoVersion=3.4.13.0
VersionInfoVersion=3.4.15.0

; dialog support
LicenseFile=..\license
Expand Down
3 changes: 2 additions & 1 deletion library/fhir/fhir_tx.pas
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ procedure TTerminologyOperationContext.addNote(vs : TFHIRValueSetW; note: String
s : string;
begin
s := DescribePeriodMS(GetTickCount64 - FStartTime)+' '+vs.vurl+': '+note;
Logging.log(s);
if UnderDebugger then
Logging.log(s);
FNotes.add(s);
end;

Expand Down
91 changes: 67 additions & 24 deletions library/ftx/ftx_loinc_services.pas
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ TLOINCServices = class (TCodeSystemProvider)
FRelationships : TDictionary<String, String>;
FProperties : TDictionary<String, String>;
FStatusKeys : TDictionary<String, String>;
function filterBySQL(c : TFDBConnection; sql, lsql : String) : TCodeSystemProviderFilterContext;
function filterBySQL(c : TFDBConnection; sql, lsql : String; forIteration : boolean) : TCodeSystemProviderFilterContext;
protected
function sizeInBytesV(magic : integer) : cardinal; override;
public
Expand All @@ -196,6 +196,7 @@ TLOINCServices = class (TCodeSystemProvider)
function Code(context : TCodeSystemProviderContext) : string; override;
function Display(context : TCodeSystemProviderContext; langList : THTTPLanguageList) : string; override;
procedure Designations(context : TCodeSystemProviderContext; list : TConceptDesignations); override;
function doesFilter(prop : String; op : TFhirFilterOperator; value : String) : boolean; override;
function filter(forIteration : boolean; prop : String; op : TFhirFilterOperator; value : String; prep : TCodeSystemProviderFilterPreparationContext) : TCodeSystemProviderFilterContext; override;
function FilterMore(ctxt : TCodeSystemProviderFilterContext) : boolean; override;
function filterSize(ctxt : TCodeSystemProviderFilterContext) : integer; override;
Expand Down Expand Up @@ -853,6 +854,44 @@ procedure TLOINCServices.Designations(context: TCodeSystemProviderContext; list:
end;
end;

function TLOINCServices.doesFilter(prop: String; op: TFhirFilterOperator; value: String): boolean;
var
ts : TStringList;
reg : TRegularExpression;
begin
result := false;
if (FRelationships.ContainsKey(prop) and (op = foEqual)) then
if FCodes.ContainsKey(value) then
result := true
else
result := true
else if (FProperties.ContainsKey(prop) and (op = foEqual)) then
result := true
else if (FRelationships.ContainsKey(prop) and (op = foExists)) then
if FCodes.ContainsKey(value) then
result := true
else
result := true
else if (FProperties.ContainsKey(prop) and (op = foExists)) then
result := true
else if (prop = 'STATUS') and (op = foEqual)and (FStatusKeys.ContainsKey(value)) then
result := true
else if (prop = 'LIST') and (op = foEqual) and (FCodes.ContainsKey(value)) then
result := true
else if (FRelationships.ContainsKey(prop)) and (op = foRegex) then
result := true
else if (FProperties.ContainsKey(prop)) and (op = foRegex) then
result := true
else if (prop = 'concept') and (op in [foIsA, foDescendentOf]) then
result := true
else if (prop = 'copyright') and (op = foEqual) and (value = 'LOINC') then
result := true
else if (prop = 'copyright') and (op = foEqual) and (value = '3rdParty') then
result := true
else
result := false;
end;

procedure TLOINCServices.extendLookup(factory : TFHIRFactory; ctxt: TCodeSystemProviderContext; langList : THTTPLanguageList; props: TArray<String>; resp: TFHIRLookupOpResponseW);
var
c : TFDBConnection;
Expand Down Expand Up @@ -960,25 +999,29 @@ function TLOINCServices.InFilter(ctxt: TCodeSystemProviderFilterContext; concept
result := (ctxt as TLoincFilterHolder).HasKey((concept as TLoincProviderContext).Key);
end;

function TLOINCServices.filterBySQL(c : TFDBConnection; sql, lsql: String): TCodeSystemProviderFilterContext;
function TLOINCServices.filterBySQL(c : TFDBConnection; sql, lsql: String; forIteration : boolean): TCodeSystemProviderFilterContext;
var
keys : TKeyArray;
l : integer;
begin
SetLength(keys, 1000);
l := 0;
c.select(sql);
while c.fetchnext do
if (forIteration) then
begin
if (c.ColKeyByName['Key'] <> 0) then
SetLength(keys, 1000);
l := 0;
c.select(sql);
while c.fetchnext do
begin
if (l = length(keys)) then
SetLength(keys, l + 1000);
keys[l] := c.ColKeyByName['Key'];
inc(l);
if (c.ColKeyByName['Key'] <> 0) then
begin
if (l = length(keys)) then
SetLength(keys, l + 1000);
keys[l] := c.ColKeyByName['Key'];
inc(l);
end;
end;
c.terminate;
end;
c.terminate;
SetLength(keys, l);
result := TLoincFilterHolder.create;
TLoincFilterHolder(result).FKeys := keys;
Expand All @@ -997,29 +1040,29 @@ function TLOINCServices.filter(forIteration : boolean; prop: String; op: TFhirFi
if (FRelationships.ContainsKey(prop) and (op = foEqual)) then
if FCodes.ContainsKey(value) then
result := FilterBySQL(c, 'select SourceKey as Key from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') order by SourceKey ASC',
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') and SourceKey = ')
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') and SourceKey = ', forIteration)
else
result := FilterBySQL(c, 'select SourceKey as Key from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Description = '''+sqlwrapString(value)+''' COLLATE NOCASE) order by SourceKey ASC',
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Description = '''+sqlwrapString(value)+''' COLLATE NOCASE) and SourceKey = ')
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in (select CodeKey from Codes where Description = '''+sqlwrapString(value)+''' COLLATE NOCASE) and SourceKey = ', forIteration)
else if (FProperties.ContainsKey(prop) and (op = foEqual)) then
result := FilterBySQL(c, 'select CodeKey as Key from Properties, PropertyValues where Properties.PropertyTypeKey = '+FProperties[prop]+' and Properties.PropertyValueKey = PropertyValues.PropertyValueKey and PropertyValues.Value = '''+SQLWrapString(value)+''' COLLATE NOCASE order by CodeKey ASC',
'select count(CodeKey) from Properties, PropertyValues where Properties.PropertyTypeKey = '+FProperties[prop]+' and Properties.PropertyValueKey = PropertyValues.PropertyValueKey and PropertyValues.Value = '''+SQLWrapString(value)+''' COLLATE NOCASE and CodeKey = ')
'select count(CodeKey) from Properties, PropertyValues where Properties.PropertyTypeKey = '+FProperties[prop]+' and Properties.PropertyValueKey = PropertyValues.PropertyValueKey and PropertyValues.Value = '''+SQLWrapString(value)+''' COLLATE NOCASE and CodeKey = ', forIteration)
else if (FRelationships.ContainsKey(prop) and (op = foExists)) then
if FCodes.ContainsKey(value) then
result := FilterBySQL(c, 'select SourceKey as Key from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) order by SourceKey ASC',
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) and SourceKey = ')
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) and SourceKey = ', forIteration)
else
result := FilterBySQL(c, 'select SourceKey as Key from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Description = '''+sqlwrapString(value)+''' COLLATE NOCASE)) order by SourceKey ASC',
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Description = '''+sqlwrapString(value)+''' COLLATE NOCASE)) and SourceKey = ')
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and exists (select CodeKey from Codes where (Description = '''+sqlwrapString(value)+''' COLLATE NOCASE)) and SourceKey = ', forIteration)
else if (FProperties.ContainsKey(prop) and (op = foExists)) then
result := FilterBySQL(c, 'select distinct CodeKey as Key from Properties where Properties.PropertyTypeKey = '+FProperties[prop]+' order by CodeKey ASC',
'select count(CodeKey) from Properties where Properties.PropertyTypeKey = '+FProperties[prop]+' and CodeKey = ')
'select count(CodeKey) from Properties where Properties.PropertyTypeKey = '+FProperties[prop]+' and CodeKey = ', forIteration)
else if (prop = 'STATUS') and (op = foEqual)and (FStatusKeys.ContainsKey(value)) then
result := FilterBySQL(c, 'select CodeKey as Key from Codes where StatusKey = '+FStatusKeys[value]+' order by CodeKey ASC',
'select count(CodeKey) from Codes where StatusKey = '+FStatusKeys[value]+' and CodeKey = ')
'select count(CodeKey) from Codes where StatusKey = '+FStatusKeys[value]+' and CodeKey = ', forIteration)
else if (prop = 'LIST') and (op = foEqual) and (FCodes.ContainsKey(value)) then
result := FilterBySQL(c, 'select TargetKey as Key from Relationships where RelationshipTypeKey = '+FRelationships['Answer']+' and SourceKey in (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) order by SourceKey ASC',
'select count(TargetKey) from Relationships where RelationshipTypeKey = '+FRelationships['Answer']+' and SourceKey in (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) and TargetKey = ')
'select count(TargetKey) from Relationships where RelationshipTypeKey = '+FRelationships['Answer']+' and SourceKey in (select CodeKey from Codes where (Code = '''+sqlwrapString(value)+''')) and TargetKey = ', forIteration)
else if (FRelationships.ContainsKey(prop)) and (op = foRegex) then
begin
reg := TRegularExpression.Create(value);
Expand All @@ -1032,7 +1075,7 @@ function TLOINCServices.filter(forIteration : boolean; prop: String; op: TFhirFi
ts.add(c.ColStringByName['Key']);
c.terminate;
result := FilterBySQL(c, 'select SourceKey as Key from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in ('+ts.CommaText+') order by SourceKey ASC',
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in ('+ts.CommaText+') and SourceKey = ')
'select count(SourceKey) from Relationships where RelationshipTypeKey = '+FRelationships[prop]+' and TargetKey in ('+ts.CommaText+') and SourceKey = ', forIteration)
finally
ts.free;
end;
Expand All @@ -1052,7 +1095,7 @@ function TLOINCServices.filter(forIteration : boolean; prop: String; op: TFhirFi
ts.add(c.ColStringByName['PropertyValueKey']);
c.terminate;
result := FilterBySQL(c, 'select CodeKey as Key from Properties where PropertyTypeKey = '+FProperties[prop]+' and PropertyValueKey in ('+ts.CommaText+') order by CodeKey ASC',
'select count(CodeKey) from Properties where PropertyTypeKey = '+FProperties[prop]+' and PropertyValueKey in ('+ts.CommaText+') and CodeKey = ')
'select count(CodeKey) from Properties where PropertyTypeKey = '+FProperties[prop]+' and PropertyValueKey in ('+ts.CommaText+') and CodeKey = ', forIteration)
finally
ts.free;
end;
Expand All @@ -1062,13 +1105,13 @@ function TLOINCServices.filter(forIteration : boolean; prop: String; op: TFhirFi
end
else if (prop = 'concept') and (op in [foIsA, foDescendentOf]) then
result := FilterBySQL(c, 'select DescendentKey as Key from Closure where AncestorKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') order by DescendentKey ASC',
'select count(DescendentKey) from Closure where AncestorKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') and DescendentKey = ')
'select count(DescendentKey) from Closure where AncestorKey in (select CodeKey from Codes where Code = '''+sqlwrapString(value)+''') and DescendentKey = ', forIteration)
else if (prop = 'copyright') and (op = foEqual) and (value = 'LOINC') then
result := FilterBySQL(c, 'select CodeKey as Key from Codes where not CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) order by CodeKey ASC',
'select count(CodeKey) from Codes where not CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) and CodeKey = ' )
'select count(CodeKey) from Codes where not CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) and CodeKey = ', forIteration)
else if (prop = 'copyright') and (op = foEqual) and (value = '3rdParty') then
result := FilterBySQL(c, 'select CodeKey as Key from Codes where CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) order by CodeKey ASC',
'select count(CodeKey) from Codes where CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) and CodeKey = ')
'select count(CodeKey) from Codes where CodeKey in (select CodeKey from Properties where PropertyTypeKey = 9) and CodeKey = ', forIteration)
else
result := nil;
c.release;
Expand Down
2 changes: 1 addition & 1 deletion library/ftx/ftx_service.pas
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ function TConceptDesignations.langMatches(lang : THTTPLanguageEntry; stated: TIE

if (lang.ietf = nil) then
lang.ietf := FLanguages.parse(lang.lang);
if (lang.ietf <> nil) and lang.ietf.matches(stated, depthForMatchType(matchType)) then
if (lang.ietf <> nil) and lang.ietf.matches(actual, depthForMatchType(matchType)) then
exit(true);
end;
end;
Expand Down
6 changes: 3 additions & 3 deletions library/version.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FHIR_CODE_FULL_VERSION = '3.4.13';
FHIR_CODE_RELEASE_DATE = '2024-09-23';
FHIR_CODE_RELEASE_DATETIME = '20240923092555.964Z';
FHIR_CODE_FULL_VERSION = '3.4.15';
FHIR_CODE_RELEASE_DATE = '2024-09-24';
FHIR_CODE_RELEASE_DATETIME = '20240924122536.288Z';
2 changes: 1 addition & 1 deletion server/endpoint_storage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,7 @@ procedure TStorageWebEndpoint.SendError(response: TIdHTTPResponseInfo; logid: st
FContext.factory.setXhtml(issue.Resource, TFHIRXhtmlParser.Parse(langList, xppReject, [], '<div><p>' + FormatTextToXML(message, xmlText) + '</p></div>'));
iss := FContext.factory.makeIssue(isError, code, '', message);
try
// iss.diagnostics := ExceptionStack(e);
iss.diagnostics := diagnostics;
issue.addIssue(iss, false);
finally
iss.free;
Expand Down
2 changes: 1 addition & 1 deletion server/fhirconsole.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<VersionInfo>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="13"/>
<RevisionNr Value="15"/>
<Attributes pvaDebug="False"/>
</VersionInfo>
<BuildModes Count="8">
Expand Down
4 changes: 2 additions & 2 deletions server/fhirserver.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_MinorVer>4</VerInfo_MinorVer>
<VerInfo_Release>13</VerInfo_Release>
<VerInfo_Release>15</VerInfo_Release>
<VerInfo_Debug>false</VerInfo_Debug>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Base_Win32)&apos;!=&apos;&apos;">
Expand Down Expand Up @@ -167,7 +167,7 @@
<DCC_RangeChecking>true</DCC_RangeChecking>
<DCC_DebugDCUs>false</DCC_DebugDCUs>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_Release>13</VerInfo_Release>
<VerInfo_Release>15</VerInfo_Release>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
<VerInfo_MinorVer>4</VerInfo_MinorVer>
<VerInfo_Debug>false</VerInfo_Debug>
Expand Down
2 changes: 1 addition & 1 deletion server/fhirserver.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="13"/>
<RevisionNr Value="15"/>
<Attributes pvaDebug="False"/>
</VersionInfo>
<BuildModes Count="8">
Expand Down
2 changes: 1 addition & 1 deletion toolkit2/fhirtoolkit.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="13"/>
<RevisionNr Value="15"/>
<Attributes pvaDebug="False"/>
</VersionInfo>
<BuildModes>
Expand Down

0 comments on commit 6aa4f6a

Please sign in to comment.