Convert modifiers and comparators

This commit is contained in:
dotasek 2023-04-18 17:13:46 -04:00
parent b740c8f998
commit e34411d4e5
2 changed files with 121 additions and 15 deletions

View File

@ -7,11 +7,14 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.*;
import org.hl7.fhir.r4b.model.SubscriptionTopic;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SubscriptionTopic43_50 {
@ -97,18 +100,55 @@ public class SubscriptionTopic43_50 {
if (src.hasComparator()) {
}
if (src.hasModifier()) {
/* tgt.setModifier(
src.getModifier().stream()
.map(SubscriptionTopic43_50::convertSearchModifierCode)
.collect(Collectors.toList()));
*/
if (src.hasModifier() || src.hasComparator()) {
List<org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier>> tgtModifiers = convertR5ModifierToR4BModifier(src.getModifier());
List<org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier>> tgtComparatorModifiers = convertR5ComparatorToR4BModifier(src.getComparator());
tgt.setModifier(Stream.concat(tgtModifiers.stream(), tgtComparatorModifiers.stream())
.collect(Collectors.toList()));
}
return tgt;
}
private static List<org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier>> convertR5ComparatorToR4BModifier(List<Enumeration<Enumerations.SearchComparator>> srcList) {
return srcList.stream().map(SubscriptionTopic43_50::convertR5ComparatorToR4BModifier).filter(x -> x != null).collect(Collectors.toList());
}
private static org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier> convertR5ComparatorToR4BModifier(Enumeration<Enumerations.SearchComparator> src){
org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifierEnumFactory enumFactory = new org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifierEnumFactory();
switch(src.getValue()) {
case NULL: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.NULL);
case EQ: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.EQ);
case NE: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.NE);
case GT: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.GT);
case LT: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.LT);
case GE: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.GE);
case LE: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.LE);
case SA: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.SA);
case EB: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.EB);
case AP: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.AP);
}
return null;
}
private static List<org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier>> convertR5ModifierToR4BModifier(List<Enumeration<Enumerations.SearchModifierCode>> srcList) {
return srcList.stream().map(SubscriptionTopic43_50::convertR5ModifierToR4BModifier).filter(x -> x != null).collect(Collectors.toList());
}
private static org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier> convertR5ModifierToR4BModifier(Enumeration<Enumerations.SearchModifierCode> src){
org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifierEnumFactory enumFactory = new org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifierEnumFactory();
switch(src.getValue()) {
case NULL: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.NULL);
case IN: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.IN);
case NOTIN: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.NOTIN);
case BELOW: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.BELOW);
case ABOVE: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.ABOVE);
case OFTYPE: return new org.hl7.fhir.r4b.model.Enumeration<>(enumFactory, SubscriptionTopic.SubscriptionSearchModifier.OFTYPE);
}
return null;
}
private static org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent convertResourceTrigger(org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent src) {
org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent tgt = new org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
@ -222,7 +262,8 @@ public class SubscriptionTopic43_50 {
if (src.hasEffectivePeriod())
tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
for(org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent triggerComponent : src.getResourceTrigger()) {
tgt.addResourceTrigger(convertResourceTrigger(triggerComponent));}
tgt.addResourceTrigger(convertResourceTrigger(triggerComponent));
}
for (org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicCanFilterByComponent canFilterByComponent : src.getCanFilterBy()) {
tgt.addCanFilterBy(convertCanFilterBy(canFilterByComponent));
}
@ -257,15 +298,62 @@ public class SubscriptionTopic43_50 {
}
if (src.hasModifier()) {
/* tgt.setModifier(
src.getModifier().stream()
.map(SubscriptionTopic43_50::convertSearchModifierCode)
.collect(Collectors.toList()));
*/
List<Enumeration<Enumerations.SearchModifierCode>> tgtModifiers = convertR4BModifierToR5Modifier(src.getModifier());
tgt.setModifier(tgtModifiers);
List<Enumeration<Enumerations.SearchComparator>> tgtComparators = covertR4BModifierToR5Comparator(src.getModifier());
tgt.setComparator(tgtComparators);
}
return tgt;
}
private static List<Enumeration<Enumerations.SearchComparator>> covertR4BModifierToR5Comparator(List<org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier>> srcList) {
return srcList.stream().map(SubscriptionTopic43_50::convertR4BModifierToR5Comparator).filter(x -> x != null).collect(Collectors.toList());
}
private static Enumeration<Enumerations.SearchComparator> convertR4BModifierToR5Comparator(org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier> src) {
Enumerations.SearchComparatorEnumFactory enumFactory = new Enumerations.SearchComparatorEnumFactory();
switch(src.getValue()) {
case NULL: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.NULL);
case EQ: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.EQ);
case NE: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.NE);
case GT: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.GT);
case LT: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.LT);
case GE: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.GE);
case LE: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.LE);
case SA: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.SA);
case EB: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.EB);
case AP: return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchComparator.AP);
}
return null;
}
private static List<org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.SearchModifierCode>> convertR4BModifierToR5Modifier(
List
<org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifier>> srcList) {
return srcList.stream().map(SubscriptionTopic43_50::convertR4BModifierToR5Modifier).filter(x -> x != null).collect(Collectors.toList());
}
private static org.hl7.fhir.r5.model.Enumeration<Enumerations.SearchModifierCode> convertR4BModifierToR5Modifier(org.hl7.fhir.r4b.model.Enumeration<SubscriptionTopic.SubscriptionSearchModifier> src) {
org.hl7.fhir.r5.model.Enumerations.SearchModifierCodeEnumFactory enumFactory = new org.hl7.fhir.r5.model.Enumerations.SearchModifierCodeEnumFactory();
switch(src.getValue()) {
case NULL:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.NULL);
case IN:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.IN);
case NOTIN:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.NOTIN);
case BELOW:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.BELOW);
case ABOVE:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.ABOVE);
case OFTYPE:
return new org.hl7.fhir.r5.model.Enumeration<>(enumFactory, Enumerations.SearchModifierCode.OFTYPE);
}
return null;
}
private static org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent convertResourceTrigger(org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent src) {
org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent tgt = new org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);

View File

@ -37,7 +37,25 @@
"description" : "Filter based on the group membership of the subject of an encounter.",
"resource" : "Encounter",
"filterParameter" : "_in"
}],
},
{
"description" : "Filter based on the length of an encounter.",
"resource" : "Encounter",
"filterParameter" : "length",
"comparator" : ["gt",
"lt",
"ge",
"le"]
},
{
"description" : "Filter based on the account for billing an encounter.",
"resource" : "Encounter",
"filterParameter" : "account",
"modifier" : [
"not-in"
]
}
],
"notificationShape" : [{
"resource" : "Encounter",
"include" : ["Encounter:patient&iterate=Patient.link",