FHIR facade, override FHIR Search and return OperationOutcome
Hello,
I'm trying to customize error handling in the overriden HS.FHIRServer.Storage.JsonAdvSQL.Interactions::Search
method. It is clear how to add to the resultset a valid FHIR resource (pseudocode):
Method Search(pResourceType As %String, pCompartment As %String, pCompartmentId As %String, pParameters As HS.FHIRServer.API.Data.QueryParameters = "", ByRef pSortKeys = "") As HS.FHIRServer.Util.SearchResult
{
#Dim resultSet as HS.FHIRServer.Util.SearchResult
Set resultSet = ##class(HS.FHIRServer.Util.SearchResult).Create()
If (pResourceType = "Patient")
{
Set patientDynamicObject = ..MethodWhichLoadsPatient()
Do resultSet.AddRow(somePatientId, "Patient", somePatientId, "1", "match",,patientDynamicObject)
Return resultSet
}
}
But, what should be done to add an error to the resultset? E.g.:
{
"resourceType": "Bundle",
"type": "searchset",
"entry":
[
{
// the `resource` property should be omitted
"response":
{
"status": 500,
"outcome":
{
"resourceType": "OperationOutcome",
...
}
}
}
]
}
Product version: IRIS 2024.3
Found the answer. It is simply not allowed: "+ Rule: For collections of type document, message, searchset or collection, all entries must contain resources, and not have request or response elements"