Skip to content

Commit

Permalink
server metadata and search conformance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Nov 11, 2024
1 parent 657d7e9 commit bbf54d4
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 36 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ testcases/snomed/snomed.cache
utilities/codescan/codescan

install/build/FHIRToolkit.app
/install/release-notes-old.md
/.zuliprc
/install/release-notes.md
/load-password.bat
Expand All @@ -71,9 +70,7 @@ install/build/FHIRToolkit.zip
exec/Resources
/dependencies/Indy10-mod-static
/dependencies/indy-master
/release-notes.md
/install/build
/release-notes-old.md
/tools
/library/fhir4b-gen
/library/fhir5-gen
Expand Down
6 changes: 5 additions & 1 deletion library/fhir/fhir_common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,9 @@ TFhirCapabilityStatementRestResourceW = class (TFHIRXVersionElementWrapper)
property profile : String read GetProfile write SetProfile;
property readHistory : boolean read GetReadHistory write SetReadHistory;
function hasInteraction : boolean; virtual; abstract;
procedure addInteraction(code : String); virtual; abstract;
procedure addInteraction(code : String; doco : String = ''); virtual; abstract;
procedure addParam(html, n, url, d : String; t : TFHIRSearchParamType; tgts : Array of String); virtual; abstract;
procedure addOperation(code, definition, doco : String); virtual; abstract;
end;

TCapabilityStatementKind = (cskNull, cskInstance, cskCapability, cskRequirements);
Expand All @@ -589,6 +590,8 @@ TFHIRCapabilityStatementW = class (TFHIRXVersionResourceWrapper)
procedure setUrl(Value: String); virtual; abstract;
function getName : String; virtual; abstract;
procedure setName(value : String); virtual; abstract;
function getTitle : String; virtual; abstract;
procedure setTitle(value : String); virtual; abstract;
function getVersion : String; virtual; abstract;
procedure setVersion(value : String); virtual; abstract;
function getDescription : String; virtual; abstract;
Expand All @@ -608,6 +611,7 @@ TFHIRCapabilityStatementW = class (TFHIRXVersionResourceWrapper)

property url : String read getURL write SetUrl;
property name : String read GetName write SetName;
property title : String read GetTitle write SetTitle;
property version : String read GetVersion write SetVersion;
property status : TPublicationStatus read GetStatus write SetStatus;
property kind : TCapabilityStatementKind read getKind write setKind;
Expand Down
8 changes: 4 additions & 4 deletions library/fhir/fhir_graphql.pas
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ procedure TFHIRGraphQLEngine.processSearchFull(target: TGraphQLObjectValue; fiel
params.Clear;
StringSplit(getSingleValue(carg), ':', l, r);
params.Add(TGraphQLArgument.Create('search-id', TGraphQLStringValue.Create(l)));
params.Add(TGraphQLArgument.Create('search-offset', TGraphQLStringValue.Create(r)));
params.Add(TGraphQLArgument.Create('offset', TGraphQLStringValue.Create(r)));
end;

bnd := FOnSearch(FAppinfo, field.Name.Substring(0, field.Name.Length-10), params);
Expand Down Expand Up @@ -1049,7 +1049,7 @@ function TFHIRGraphQLSearchWrapper.extractLink(name: String): TFHIRObject;
begin
pm := THTTPParameters.Create(s.Substring(s.IndexOf('?')+1));
try
result := FBundle.makeStringValue(pm['search-id']+':'+pm['search-offset']);
result := FBundle.makeStringValue(pm['search-id']+':'+pm['offset']);
finally
pm.free;
end;
Expand All @@ -1074,7 +1074,7 @@ function TFHIRGraphQLSearchWrapper.fhirType: String;
result := '*Connection';
end;

// http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=50&_count=50
// http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&offset=50&_count=50

function TFHIRGraphQLSearchWrapper.getId: String;
begin
Expand All @@ -1098,7 +1098,7 @@ function TFHIRGraphQLSearchWrapper.getPropertyValue(propName: string): TFHIRProp
else if propName = 'count' then
result := TFHIRProperty.Create(self, propname, 'integer', false, nil, makeIntValue(inttostr(FBundle.total)))
else if propName = 'offset' then
result := TFHIRProperty.Create(self, propname, 'integer', false, nil, extractParam('search-offset', true))
result := TFHIRProperty.Create(self, propname, 'integer', false, nil, extractParam('offset', true))
else if propName = 'pagesize' then
result := TFHIRProperty.Create(self, propname, 'integer', false, nil, extractParam('_count', true))
else if propName = 'edges' then
Expand Down
2 changes: 1 addition & 1 deletion library/fhir/fhir_objects.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
SYSTEM_NOT_APPLICABLE = '%%null%%';
SEARCH_PARAM_NAME_ID = 'search-id';
HISTORY_PARAM_NAME_ID = 'history-id';
SEARCH_PARAM_NAME_OFFSET = 'search-offset';
SEARCH_PARAM_NAME_OFFSET = 'offset';
SEARCH_PARAM_NAME_TEXT = '_text';
SEARCH_PARAM_NAME_COUNT = '_count';
SEARCH_PARAM_NAME_SORT = '_sort';
Expand Down
27 changes: 24 additions & 3 deletions library/fhir2/fhir2_common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ TFhirCapabilityStatementRestResource2 = class (TFhirCapabilityStatementRestRes
procedure setCode(Value: String); override;
function getProfile: String; override;
procedure setProfile(Value: String); override;
procedure addInteraction(code : String); override;
procedure addInteraction(codeV, doco : String); override;
procedure addOperation(code, definition, doco : String); override;
function getReadHistory: boolean; override;
procedure setReadHistory(Value: boolean); override;
function hasInteraction : boolean; override;
Expand Down Expand Up @@ -330,6 +331,8 @@ TFHIRCapabilityStatement2 = class (TFHIRCapabilityStatementW)
procedure setUrl(Value: String); override;
function getName : String; override;
procedure setName(value : String); override;
function getTitle : String; override;
procedure setTitle(value : String); override;
function getVersion : String; override;
procedure setVersion(value : String); override;
function getDescription : String; override;
Expand Down Expand Up @@ -1833,6 +1836,16 @@ procedure TFHIRCapabilityStatement2.setName(value : String);
statement.Name := value;
end;

function TFHIRCapabilityStatement2.getTitle : String;
begin
result := ''; // statement.Title;
end;

procedure TFHIRCapabilityStatement2.setTitle(value : String);
begin
// statement.Title := value;
end;

function TFHIRCapabilityStatement2.getVersion : String;
begin
result := statement.Version;
Expand Down Expand Up @@ -4930,9 +4943,17 @@ procedure TFhirCapabilityStatementRestResource2.setProfile(Value: String);
end;


procedure TFhirCapabilityStatementRestResource2.addInteraction(code: String);
procedure TFhirCapabilityStatementRestResource2.addInteraction(codeV, doco: String);
begin
With (Element as TFhirCapabilityStatementRestResource).interactionList.Append do
begin
codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', codeV);
documentation := doco;
end;
end;

procedure TFhirCapabilityStatementRestResource2.addOperation(code, definition, doco: String);
begin
(Element as TFhirCapabilityStatementRestResource).interactionList.Append.codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', code);
end;

function TFhirCapabilityStatementRestResource2.getReadHistory: boolean;
Expand Down
27 changes: 24 additions & 3 deletions library/fhir3/fhir3_common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ TFhirCapabilityStatementRestResource3 = class (TFhirCapabilityStatementRestRes
function getProfile: String; override;
function hasInteraction : boolean; override;
procedure setProfile(Value: String); override;
procedure addInteraction(code : String); override;
procedure addInteraction(codeV, doco : String); override;
procedure addOperation(codeV, defn, doco : String); override;
function getReadHistory: boolean; override;
procedure setReadHistory(Value: boolean); override;
procedure addParam(html, n, url, d : String; t : TFHIRSearchParamType; tgts : Array of String); override;
Expand Down Expand Up @@ -344,6 +345,8 @@ TFHIRCapabilityStatement3 = class (TFHIRCapabilityStatementW)
procedure setUrl(Value: String); override;
function getName : String; override;
procedure setName(value : String); override;
function getTitle : String; override;
procedure setTitle(value : String); override;
function getVersion : String; override;
procedure setVersion(value : String); override;
function getDescription : String; override;
Expand Down Expand Up @@ -1979,6 +1982,16 @@ procedure TFHIRCapabilityStatement3.setName(value : String);
statement.Name := value;
end;

function TFHIRCapabilityStatement3.getTitle : String;
begin
result := statement.Title;
end;

procedure TFHIRCapabilityStatement3.setTitle(value : String);
begin
statement.Title := value;
end;

function TFHIRCapabilityStatement3.getVersion : String;
begin
result := statement.Version;
Expand Down Expand Up @@ -5613,9 +5626,17 @@ procedure TFhirCapabilityStatementRestResource3.setProfile(Value: String);
(Element as TFhirCapabilityStatementRestResource).profile := TFhirReference.Create(value);
end;

procedure TFhirCapabilityStatementRestResource3.addInteraction(code: String);
procedure TFhirCapabilityStatementRestResource3.addInteraction(codeV, doco: String);
begin
With (Element as TFhirCapabilityStatementRestResource).interactionList.Append do
begin
codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', codeV);
documentation := doco;
end;
end;

procedure TFhirCapabilityStatementRestResource3.addOperation(codeV, defn, doco: String);
begin
(Element as TFhirCapabilityStatementRestResource).interactionList.Append.codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', code);
end;

function TFhirCapabilityStatementRestResource3.getReadHistory: boolean;
Expand Down
33 changes: 30 additions & 3 deletions library/fhir4/fhir4_common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ TFhirCapabilityStatementRestResource4 = class (TFhirCapabilityStatementRestRes
function getProfile: String; override;
function hasInteraction : boolean; override;
procedure setProfile(Value: String); override;
procedure addInteraction(code : String); override;
procedure addInteraction(codeV, doco : String); override;
procedure addOperation(codeV, defn, doco : String); override;
function getReadHistory: boolean; override;
procedure setReadHistory(Value: boolean); override;
procedure addParam(html, n, url, d : String; t : TFHIRSearchParamType; tgts : Array of String); override;
Expand Down Expand Up @@ -343,6 +344,8 @@ TFHIRCapabilityStatement4 = class (TFHIRCapabilityStatementW)
procedure setUrl(Value: String); override;
function getName : String; override;
procedure setName(value : String); override;
function getTitle : String; override;
procedure setTitle(value : String); override;
function getVersion : String; override;
procedure setVersion(value : String); override;
function getDescription : String; override;
Expand Down Expand Up @@ -1969,6 +1972,16 @@ procedure TFHIRCapabilityStatement4.setName(value : String);
statement.Name := value;
end;

function TFHIRCapabilityStatement4.getTitle : String;
begin
result := statement.Title;
end;

procedure TFHIRCapabilityStatement4.setTitle(value : String);
begin
statement.Title := value;
end;

function TFHIRCapabilityStatement4.getVersion : String;
begin
result := statement.Version;
Expand Down Expand Up @@ -5288,9 +5301,23 @@ procedure TFhirCapabilityStatementRestResource4.setProfile(Value: String);
(Element as TFhirCapabilityStatementRestResource).profile := value;
end;

procedure TFhirCapabilityStatementRestResource4.addInteraction(code: String);
procedure TFhirCapabilityStatementRestResource4.addInteraction(codeV, doco: String);
begin
(Element as TFhirCapabilityStatementRestResource).interactionList.Append.codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', code);
With (Element as TFhirCapabilityStatementRestResource).interactionList.Append do
begin
codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', codeV);
documentation := doco;
end;
end;

procedure TFhirCapabilityStatementRestResource4.addOperation(codeV, defn, doco: String);
begin
With (Element as TFhirCapabilityStatementRestResource).operationList.Append do
begin
name := codeV;
definition := defn;
documentation := doco;
end;
end;

function TFhirCapabilityStatementRestResource4.getReadHistory: boolean;
Expand Down
4 changes: 2 additions & 2 deletions library/fhir4/tests/fhir4_tests_graphql.pas
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ function TFHIRGraphQLTest.Search(appInfo: TFslObject; requestType: String; param
with bnd.link_List.Append do
begin
relation := 'next';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=50&_count=50';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&offset=50&_count=50';
end;
with bnd.link_List.Append do
begin
relation := 'self';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=0&_count=50';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&offset=0&_count=50';
end;
with bnd.entryList.Append do
begin
Expand Down
33 changes: 30 additions & 3 deletions library/fhir4b/fhir4b_common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ TFhirCapabilityStatementRestResource4B = class (TFhirCapabilityStatementRestRe
function getProfile: String; override;
function hasInteraction : boolean; override;
procedure setProfile(Value: String); override;
procedure addInteraction(code : String); override;
procedure addInteraction(codeV, doco : String); override;
procedure addOperation(codeV, defn, doco : String); override;
function getReadHistory: boolean; override;
procedure setReadHistory(Value: boolean); override;
procedure addParam(html, n, url, d : String; t : TFHIRSearchParamType; tgts : Array of String); override;
Expand Down Expand Up @@ -344,6 +345,8 @@ TFHIRCapabilityStatement4B = class (TFHIRCapabilityStatementW)
procedure setUrl(Value: String); override;
function getName : String; override;
procedure setName(value : String); override;
function getTitle : String; override;
procedure setTitle(value : String); override;
function getVersion : String; override;
procedure setVersion(value : String); override;
function getDescription : String; override;
Expand Down Expand Up @@ -1960,6 +1963,16 @@ procedure TFHIRCapabilityStatement4B.setName(value : String);
statement.Name := value;
end;

function TFHIRCapabilityStatement4B.getTitle : String;
begin
result := statement.Title;
end;

procedure TFHIRCapabilityStatement4B.setTitle(value : String);
begin
statement.Title := value;
end;

function TFHIRCapabilityStatement4B.getVersion : String;
begin
result := statement.Version;
Expand Down Expand Up @@ -5268,9 +5281,23 @@ procedure TFhirCapabilityStatementRestResource4B.setProfile(Value: String);
(Element as TFhirCapabilityStatementRestResource).profile := value;
end;

procedure TFhirCapabilityStatementRestResource4B.addInteraction(code: String);
procedure TFhirCapabilityStatementRestResource4B.addInteraction(codeV, doco: String);
begin
(Element as TFhirCapabilityStatementRestResource).interactionList.Append.codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', code);
With (Element as TFhirCapabilityStatementRestResource).interactionList.Append do
begin
codeElement := TFhirEnum.Create('http://hl7.org/fhir/ValueSet/type-restful-interaction', codeV);
documentation := doco;
end;
end;

procedure TFhirCapabilityStatementRestResource4B.addOperation(codeV, defn, doco: String);
begin
With (Element as TFhirCapabilityStatementRestResource).operationList.Append do
begin
name := codeV;
definition := defn;
documentation := doco;
end;
end;

function TFhirCapabilityStatementRestResource4B.getReadHistory: boolean;
Expand Down
4 changes: 2 additions & 2 deletions library/fhir4b/tests/fhir4b_tests_graphql.pas
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ function TFHIRGraphQLTest.Search(appInfo: TFslObject; requestType: String; param
with bnd.link_List.Append do
begin
relation := 'next';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=50&_count=50';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&offset=50&_count=50';
end;
with bnd.link_List.Append do
begin
relation := 'self';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=0&_count=50';
url := 'http://test.fhir.org/r3/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&offset=0&_count=50';
end;
with bnd.entryList.Append do
begin
Expand Down
Loading

0 comments on commit bbf54d4

Please sign in to comment.