You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to generate C++ code from profiles (json) containing slices on structured fields (e.g. Address).
Maybe I can implement the missing feature myself, but I need some advice.
Is there a function or functions in the java part, that could be used to generate the slice message?
I have the following use case: The address field of Organization is sliced into two slices of an Adress based profile (address-de-basis) to support two different flavours of Address.line - physical address vs. post box. (This is done in an intermediate profile base "KBV_PR_Base_Organization".)
Which function could be used in the C++ part to read the different slices? (I think writing just means selection of the active slice.)
Any Idea how to implement a default slice?
Details:
From my investigations I found two problems:
In ProtoGenerator.java, slices like this are not supported:
privateDescriptorProtogenerateMessage(
ElementDefinitioncurrentElement,
List<ElementDefinition> elementList,
DescriptorProto.Builderbuilder)
throwsInvalidFhirException {
...
for (ElementDefinitiondeferredElement : deferredElements) {
// Currently we only support slicing for Extensions and Codingsif (isElementSupportedForSlicing(deferredElement)
...
} else {
cgmDebugOut(2, "Build field slicing (not supported yet):" + cgmStringify(deferredElement.getId().getValue()));
builder
.addFieldBuilder()
.setNumber(nextTag)
.getOptionsBuilder()
.setExtension(
ProtoGeneratorAnnotations.reservedReason,
"field "
+ nextTag
+ " reserved for "
+ deferredElement.getId().getValue()
+ " which uses an unsupported slicing on "
+ deferredElement.getType(0).getCode().getValue());
nextTag++;
}
}
...
}
Once the java generator would have been enhanced to generate a sliced proto message, serialization to and from json has to be handled correctly in the c++ part.
To Json: Just write the slices´ content (if any)? Maybe respecting place where the original field resides.
From Json: Detect sliced field by annotation. Extract slice discriminator (Maybe by reading into (new) instance of non sliced field when slice discrimination is on value?). Select correct slice by attribute. Read into that slice. Here, it is not clear to me, what infrastructure in C++ could be used.
If I'm right, some annotations have been foreseen for discrimination of the right slice.
Regarding annotation fhir_slice_by, I am not sure, if this is the intended use. As far as I understand, slicing type and path must be specified.
Something like this:
"[(.google.fhir.proto.fhir_slice_by) = "value:type"]" means the slice discriminator is by "value" from field "type".
The text was updated successfully, but these errors were encountered:
I need to generate C++ code from profiles (json) containing slices on structured fields (e.g. Address).
Maybe I can implement the missing feature myself, but I need some advice.
Details:
From my investigations I found two problems:
If I'm right, some annotations have been foreseen for discrimination of the right slice.
Regarding annotation fhir_slice_by, I am not sure, if this is the intended use. As far as I understand, slicing type and path must be specified.
Something like this:
"[(.google.fhir.proto.fhir_slice_by) = "value:type"]" means the slice discriminator is by "value" from field "type".
The text was updated successfully, but these errors were encountered: