FHIR .NET API How to support Unknown Member in Resource? - hl7-fhir

I am working with a FHIR server that has Customized member in the resource.
Say if we receive a Patient with the following
xml = "<Patient xmlns='http://hl7.org/fhir'><hasSuperPower></hasSuperPower></Patient>";
How do I add the extra tag support in the FHIR .NET API so I can work with this Customized Resource? (so that the Deserilizer can process it and put it in a Patient Object.)
I have read from Mirjam Baltus 's post that the Model classes can be enhanced because they are all declared as "Partial class". Does
this mean I have to work with the FHIR API source code and add my own Partial class there and then re-compile it?
Would there be a way that I can just use the DLL from Nuget without have to touch the source code?

Why would you use a customized element rather than the standard extension element? Adding custom elements in this way is not compliant with the standard, won't work with any of the public test servers, won't interoperate with other FHIR systems and won't work with the reference implementations. Have you looked at the extensibility portion of the spec?

I've answered this in the Google forum as well, and agree with Lloyd.
If you receive a Patient with a <hasSuperPower> tag, that is not a FHIR compliant Patient.
FHIR has an excellent way to communicate data that doesn't fit in any of the standard fields, called extensions. If you use these, there is no need to write extra code to handle non-FHIR resources, and you can just use the existing libraries without having to change anything to them.
The superpower ability could look like this, and be FHIR compliant:
<Patient xmlns="http://hl7.org/fhir">
<extension url="http://mirjams.example.org/fhir/StructureDefinition/super-patient">
<valueBoolean value="true"/>
</extension>
</Patient>
I'd also like to point out this blog by Brian Postlethwaite about custom resource properties: https://brianpos.com/2018/05/03/code-generation-fhir-custom-resources/

Related

What do protofiles represent for googles API Linter?

since google did not create extensive documentation for their API Linter and I cannot find anything from other sources, i wanted to ask here.
From what exactly am i supposed to create protofiles and what do they represent?
As I understood, these protofiles get checked for compliance to their AIPs.
I'm interested in creating a automatic prototype (Java) to check for customized API Rules and am thinking about using Protobufer for this goal. Would this be a pragmatic solution?
Thank you!
As I now understand, Googles API Linter isn't supposed to check a API or a different API specification for compliance.
It checks proto files because they are themself the API specification and can be converted to Code. But before converting them they can be checked against rules they have to comply with.
These rules are not in the protofiles (as I initially thought) but in the many GO-files under rules/ .
Please correct me if you read this and find mistakes! Thanks!

Boost API doc location?

I was wondering if there is a javadoc style API reference for the boost libraries?
I have noticed that there are class descriptions with these type of urls:
http://www.boost.org/doc/libs/1_52_0/doc/html/boost/program_options/typed_value.html
Whereas documentation of particular libraries is at the following:
http://www.boost.org/doc/libs/1_52_0/doc/html/program_options/
Notice the html/boost subdirectory. Considering this, perhaps there is an organized/categorized API index for these raw indexes:
http://www.boost.org/doc/libs/1_52_0/doc/html/boost
http://www.boost.org/doc/libs/1_52_0/doc/html/boost/program_options/
Boost is a collection of many different libraries, by many different authors. There is no comprehensive documentation. Several of the libraries provide API documentation as you have already noted. I think the Asio API documentation is particularly well written.

How to import XML file in to Dynamics AX 2012?

I am wondering which is the best way to import XML file like (purchase orders) into Dynamics AX?
There are a few examples available via searching the web...
Axaptapedia suggests two libraries:
XMLDocument class, code example
SAXReader class, which may be better for parsing large XML files
Here are good examples of how to
Read XML
Create XML
It also depends on the size of the XML, we have seen large file sizes that caused the XMLDocument class to consume too many memory because it loads the XML in memory.
You could also use the XMLTextReader if you need performance and you don't need schema validation.
If you do need schema validation, you would have to stick to XMLDocument. (check out this article
Check out this article on codeproject that explains XMLTextReader in full detail.
http://www.codeproject.com/Articles/15452/The-XmlTextReader-A-Beginner-s-Guide
Also, I was wondering, do you have ownership of the application that produced the XML file? If it is something you have in your own hands, you might consider creating an AIF Custom service and call this from your other application. (But I guess you are not the owner of the application producing the XML file you want to import.)

What is the best way to implement the versioning for ASP.NET WebAPIs?

What is the best approach to version WebAPIs?
I am building an API from scratch and I would like to ensure that it will version gracefully in the future. I am envisioning something like mysite.com/api/v2/...
One approach I see is to create a separate project (web app) for each version of API. But perhaps there are better ways to do it?
Thank you for your ideas.
Including version number in the URL is the standard approach as I explained in this post (I do not repeat the content): Implementing versioning a RESTful API with WCF or ASP.Net Web Api
You do not need to create a completely new project although you can. The problem that you will be facing with a single project is that there will be collision of names:
/api/v1.0/Car/123
and
/api/v2.0/Car/123
both will point to CarController while you can have only one of those. The solution would be to implement your own IHttpControllerSelector and register with the DependencyResolver. This implementation will look at the version number and perhaps find the type based on the namespace.
UPDATE
I do not intend to start a REST controversy here. But as #DarrelMiller points out, here is an older discussion on the same subject discouraging my suggested approach:
How to version REST URIs
I personally think URL versioning is the way to go.
You will need to create your own implementation of IHttpControllerSelector. The best way is to base this implementation on Microsoft's IHttpControllerSelector. Then you can decide in your IHttpControllerSelectorif you want to version by URL or by content-type.
The most basic implementation directly implements IHttpControllerSelector and just implements the SelectController method but performance reasons it is better to implement some caching around it.
For finding the Controller you simple the IHttpControllerTypeResolver instance you can get using HttpConfiguration.Services.
I've used something like this: http://damsteen.nl/blog/implementing-versioning-in-asp.net-web-api. Also put some code on Github: https://github.com/Sebazzz/SDammann.WebApi.Versioning.

Sonar - Can we use for OSB/BPEL code review?

I am new to sonar,just heard about this tool.
Can we use this tool to perform code review for FMW(Fusion Middleware) -OSB(Oracle Service Bus)/BPEL project ?
If so can anyone give some inputs on this?
The official plugin-List : http://docs.codehaus.org/display/SONAR/Sonar+Plugin+Library/ does not mention support for your tools.
But sonar can be extended with custom plugins, so you may be able to write your own plugins to provide metrics for your tools.
What level of review you want to cover? It is really easy to make your own review tool for BPEL. All BPEL resources are XML files. For example if you want to check for naming convetion of BPEL activities, you can define a simple XPath based rule.
Ex:
//sequence/#name ~= "^sequence.*".
A Java program can use the above XPath to pull-out all sequence names from the xxxx.bpel file and compare it against a regular expression. Similar rules can be created for checking WSDL usage, partner links, end-point addresses, usage of Error handling etc.

Resources