brianpos / FhirPathTester

Simple WPF HL7 Fluentpath Tester tool
Other
19 stars 4 forks source link

resolve() FHIRPath function seems not to be supported #9

Open JozefAerts opened 3 years ago

cames-be commented 2 years ago

Even if this isn't the correct place, I wanted to post this for anyone that has issues getting the resolve() function to work with FhirPath. (Note, I've only tested this with STU3 and R4)

By default, the FhirPathCompiler only uses the standard FhirPath functions by invoking the AddStandardFP extension on the SymbolTable. To use the resolve(), hasValue(), memberOf(), and htmlchecks functions, the AddFhirExtensions() extension method must be called against the symbol table and passed to the FhirPathCompiler.

What this means for this project is that 3 changes need to be made (note I only looked at the WPF project):

  1. In the CustomFluentPathFunctions, the call _st = new SymbolTable().AddStandardFP(); needs to be changed to _st = new SymbolTable().AddStandardFP().AddFhirExtensions();
  2. In MainWindow.ButtonGo_Click a ScopedNode needs to be passed into the CompiledExpression. The resolve() function can only be used against a ScopedNode. This means that after creating a ScopedNode instance to wrap the ITypedExpression, the node must be passed into the CompiledExpression. prepopulatedValues = xps(inputNav, evalContext); becomes ScopedNode node = new ScopedNode(inputNav); prepopulatedValues = xps(node, evalContext);
  3. The FhirPathProcessor.ProcessPrepopulatedValues needs to be modified to hande the ScopedNode. Instead of using ToFhirValues, use the ToPoco extension off of the ScopedNode (ITypedElement).

Feel free to ask me any questions regarding FhirPath or its implementation.

brianpos commented 8 months ago

It's not supported as there is no way to setup a source server to resolve the content from. (Though I guess could at least resolve within a contained resource/bundle)