FHIR Chat · Post data to spark - exception on ExtrapolateMethod · dotnet

Stream: dotnet

Topic: Post data to spark - exception on ExtrapolateMethod


view this post on Zulip Santosh Jami (Jul 26 2017 at 00:44):

I am getting the Object reference not set to an instance of an object exception on ExtrapolateMethod when posting Bundle to Spark. Any ideas?

Here is the exception stack trace,
System.NullReferenceException occurred
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Spark.Engine
StackTrace:
at Spark.Engine.Extensions.EntryExtensions.ExtrapolateMethod(ILocalhost localhost, EntryComponent entry, IKey key) in C:\git\sparkdevelop2\src\Spark.Engine\Extensions\InteractionExtensions.cs:line 50
at Spark.Engine.Service.FhirServiceExtensions.ResourceManipulationOperationFactory.GetManipulationOperation(EntryComponent entryComponent, ILocalhost localhost, ISearchService service) in C:\git\sparkdevelop2\src\Spark.Engine\Service\FhirServiceExtensions\ResourceManipulationOperationFactory.cs:line 62
at Spark.Engine.Service.FhirServiceExtensions.TransactionService.<HandleTransaction>b__9_0(EntryComponent e) in C:\git\sparkdevelop2\src\Spark.Engine\Service\FhirServiceExtensions\TransactionService.cs:line 105
at Spark.Engine.Service.FhirServiceExtensions.TransactionService.HandleTransaction(Bundle bundle, IInteractionHandler interactionHandler) in C:\git\sparkdevelop2\src\Spark.Engine\Service\FhirServiceExtensions\TransactionService.cs:line 105
at Spark.Engine.Service.FhirService.Transaction(Bundle bundle) in C:\git\sparkdevelop2\src\Spark.Engine\Service\FhirService.cs:line 314
at Spark.Controllers.FhirController.Transaction(Bundle bundle) in C:\git\sparkdevelop2\src\Spark\Controllers\FhirController.cs:line 175
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)

And here is my xml body for the post request to Spark server:

<Bundle xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<type value="collection"/>
<entry>
<resource>
<Patient>
<id value="PID-patient-identification"/>
<text>
<status value="generated"/>
<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
<p class="L">FASTING:NO</p>
</xhtml:div>
</text>
<identifier>
<use value="official"/>
<type>
<coding>
<code value="PT"/>
</coding>
</type>
<value value=""/>
</identifier>
<name>
<use value="official"/>
<family value=""/>
</name>
<telecom>
<system value="phone"/>
<value value=""/>
<use value="home"/>
</telecom>
<gender value="female"/>
<birthDate value=""/>
<address>
<use value="home"/>
</address>
</Patient>
</resource>
</entry>
</Bundle>

I went to http://fhirtest.uhn.ca/create to test the same above message. When I did a create, got a 201 Success response.
Any ideas?

Thanks
Santosh Jami

view this post on Zulip Brian Postlethwaite (Jul 26 2017 at 01:15):

I don't know what is going here as far as the error is concerned, however the SPARK server is DSTU2, and the HAPI server at the address you provided is an SUT3 server.
Can't spot anything in that bundle that looks nasty.
(Validation on the empty strings must have been suppressed and ignored)
A pretty sparse Patient example, assuming you weren't after comments on the content of the resource itself...

view this post on Zulip Santosh Jami (Jul 26 2017 at 01:19):

Thanks Brian.I selected DSTU2 for hapi. Have you posted any successful bundle to Spark or may be point me where I can get a test bundle message to post to Spark and test it?

view this post on Zulip Santosh Jami (Jul 26 2017 at 01:26):

I posted this example that I got from github, https://github.com/ewoutkramer/fhir-net-api/blob/7bf0863b2a7ef061cde1f05e80359d5f23f4681a/src/Hl7.Fhir.Specification.Tests/TestData/grahame-validation-examples/bundle-good.xml
The end point I hit was http://spark.furore.com/fhir
But got same exception - Am I missing somethins? AM sure the bundles are tested on Spark.

{
"resourceType": "Bundle",
"id": "bundle",
"type": "collection",
"entry": [
{
"fullUrl": "http://acme.com/Patient/pat1",
"resource": {
"resourceType": "Patient",
"id" : "pat1",
"link" : {
"type" : "refer",
"other" : {
"reference" : "Patient/pat2"
}
}
}
},
{
"fullUrl": "http://acme.com/Patient/pat2",
"resource": {
"resourceType": "Patient",
"id" : "pat1"
}
}
]
}

view this post on Zulip Brian Postlethwaite (Jul 26 2017 at 02:06):

I haven't actively been working with spark for some time as we have our own implementation, so sorry can't ad much more for now.

view this post on Zulip Brian Postlethwaite (Jul 26 2017 at 02:06):

You can get the code from github and debug it yourself though ;)

view this post on Zulip Santosh Jami (Jul 26 2017 at 02:10):

Thanks @Brian Postlethwaite . Looking at the code, I found there is a null check missing in the code,
return entry.Request.Method ?? DetermineMethod(localhost, key);
my entry.Request is null, entry.Request.Method always fails

view this post on Zulip Brian Postlethwaite (Jul 26 2017 at 03:03):

Yup, looks like a bug.
You could either fix it and make a pull request, or just add the data in your submitted bundle ;)


Last updated: Apr 12 2022 at 19:14 UTC