Stream: implementers
Topic: FHIR Server .Net
Dongtu (Sep 21 2019 at 10:02):
Hi all,
I have plan build Fhir Server in .Net framework. I'm looking for git sample project to build basic CRUD operations on certain entities like patient(example). it looks like hapi-fhir-jpaserver.
Has anyone ever done that project yet? Please give me your example
Yunwei Wang (Sep 21 2019 at 14:08):
There are two .NET server implementations: Firely Spark (https://github.com/FirelyTeam/spark) and Microsoft FHIR server (https://github.com/Microsoft/fhir-server)
Brian Postlethwaite (Sep 22 2019 at 00:29):
And the fhir facade project at
Http://github.com/brianpos/fhir-net-web-api
This is one intended to show how to do it, but storage is really up to you.
Demo just uses a file system.
Dongtu (Sep 23 2019 at 01:07):
Thank you, I 'll try
Ward Weistra (Sep 24 2019 at 09:24):
And if you're not looking to build your own, you can use https://fire.ly/products/vonk/
It's not open source, but does allow for a lot of extensibility via plugins/components: http://docs.simplifier.net/vonk/components/components.html
Dongtu (Sep 30 2019 at 02:27):
Hi @Brian Postlethwaite , I tried your opensource (Http://github.com/brianpos/fhir-net-web-api). I think it suits my project.
I tested some usecase for validate resource by postman. It return html document. But I want to return OperationOutcome. How can I do that?
I debuged. Exception at line: "var resource = new FhirJsonParser().Parse<Resource>(jsonReader);"
then catch "throw new FhirServerException(HttpStatusCode.BadRequest, "Body parsing failed: " + exception.Message);"
Brian Postlethwaite (Sep 30 2019 at 03:00):
Did you put in the accept header?
Brian Postlethwaite (Sep 30 2019 at 03:00):
Application/xml+fhir
Dongtu (Sep 30 2019 at 03:02):
Yes, I did.
Dongtu (Sep 30 2019 at 03:05):
Any exception, it return html doc with error. I want return OperationOutcome example:
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"details": {
"text": "exception"
}
}
]
}
Dongtu (Sep 30 2019 at 03:08):
Brian Postlethwaite (Sep 30 2019 at 22:33):
What are you posting in the body?
That looks like a valid operation outcome in json as requested.
So I would suggest that what you are sending is dud.
Dongtu (Oct 01 2019 at 01:06):
I'm posting Patient Resource and changing value of gender 1 invalid value (ex: "gender":"abc"). It run to ReadRequestBodyAsync function in file JsonFhirFormatter.cs
Dongtu (Oct 01 2019 at 01:12):
Michele Mottini (Oct 01 2019 at 12:36):
You have to catch the errors and convert them to OperationOutcome I guess - maybe a filter is missing on the controller?
Dongtu (Oct 02 2019 at 01:21):
this is validate input function, run berfore go to controller. It throw exception when Parse msg
Yunwei Wang (Oct 02 2019 at 13:54):
What's your json payload?
Michele Mottini (Oct 02 2019 at 13:56):
The payload has an invalid gender code - so of course the parsing fails . . . what behavior were you expecting?
Yunwei Wang (Oct 02 2019 at 14:19):
I think @Dongtu expected a OperationOutcome for the invalid payload, not HTML code. @Dongtu You need to check if the server has exception filter attached. If not, you need create one to catch validation exception and convert it to OperationOutcome.
Brian Postlethwaite (Oct 02 2019 at 21:36):
This is probably new with the lack of permissive parsing in the lib. When it's updated to a later version should be ok.
Brian Postlethwaite (Oct 02 2019 at 21:36):
Can you report an issue on the github project and I'll take a look
Last updated: Apr 12 2022 at 19:14 UTC