Add missing fields to r5-r4b 1

This commit is contained in:
dotasek 2023-04-26 14:27:00 -04:00
parent 437430de39
commit a006b194c1
4 changed files with 38 additions and 2 deletions

View File

@ -31,7 +31,10 @@ public class BaseAdvisor_43_50 extends BaseAdvisor50<org.hl7.fhir.r4b.model.Exte
return true;
} else if (lastPath.equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
return true;
} else
} else if (lastPath.equals("SubscriptionTopic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.")) {
return true;
}
else
return false;
}

View File

@ -7,6 +7,7 @@ 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 java.util.List;
import java.util.stream.Collectors;
@ -53,6 +54,9 @@ public class SubscriptionTopic43_50 {
tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
if (src.hasName()) {
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name", String43_50.convertString(src.getNameElement()));
}
if (src.hasApprovalDate())
tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
if (src.hasLastReviewDate())
@ -64,12 +68,29 @@ public class SubscriptionTopic43_50 {
for (org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicCanFilterByComponent canFilterByComponent : src.getCanFilterBy()) {
tgt.addCanFilterBy(convertCanFilterBy(canFilterByComponent));
}
for (org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent eventTrigger : src.getEventTrigger()) {
tgt.addEventTrigger(convertEventTrigger(eventTrigger));
}
for (org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent notificationShape : src.getNotificationShape()) {
tgt.addNotificationShape(convertNotificationShape(notificationShape));
}
return tgt;
}
private static SubscriptionTopic.SubscriptionTopicEventTriggerComponent convertEventTrigger(org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent src) {
org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent tgt = new org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent();
if (src.hasDescription()) {
tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
}
if (src.hasEvent()) {
tgt.setEvent(CodeableConcept43_50.convertCodeableConcept(src.getEvent()));
}
if (src.hasResource()) {
tgt.setResourceElement(Uri43_50.convertUri(src.getResourceElement()));
}
return tgt;
}
private static org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent convertNotificationShape(org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent src) {
org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent tgt = new org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent();
if (src.hasResource()) {
@ -78,6 +99,9 @@ public class SubscriptionTopic43_50 {
if (src.hasInclude()) {
tgt.setInclude(src.getInclude().stream().map(String43_50::convertString).collect(Collectors.toList()));
}
if (src.hasRevInclude()) {
tgt.setRevInclude(src.getRevInclude().stream().map(String43_50::convertString).collect(Collectors.toList()));
}
return tgt;
}
@ -92,6 +116,9 @@ public class SubscriptionTopic43_50 {
if (src.hasFilterParameter()) {
tgt.setFilterParameterElement(String43_50.convertString(src.getFilterParameterElement()));
}
if (src.hasFilterDefinition()) {
// TODO r4b spec has this, but the Java model does not
}
if (src.hasModifier() || src.hasComparator()) {
List<org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.SubscriptionTopic.SubscriptionSearchModifier>> tgtModifiers = convertR5ModifierToR4BModifier(src.getModifier());
@ -182,6 +209,7 @@ public class SubscriptionTopic43_50 {
if (src.hasRequireBoth()) {
tgt.setRequireBothElement(Boolean43_50.convertBoolean(src.getRequireBothElement()));
}
return tgt;
}
@ -213,6 +241,10 @@ public class SubscriptionTopic43_50 {
org.hl7.fhir.r5.model.SubscriptionTopic tgt = new org.hl7.fhir.r5.model.SubscriptionTopic();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyResource(src, tgt);
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name")) {
tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name").getValue()));
}
if (src.hasUrl())
tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())

View File

@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class SubscriptionTopic43_50Test {
@Test
@DisplayName("Test r5 -> r4 SubscriptionTopic conversion.")
@DisplayName("Test r5 -> r4b SubscriptionTopic conversion.")
public void testR5_R4b() throws IOException {
InputStream r5_input = this.getClass().getResourceAsStream("/subscription_topic_50.json");

View File

@ -10,6 +10,7 @@
"system" : "urn:ietf:rfc:3986",
"value" : "urn:uuid:1caa02ba-051b-4602-8856-65921748ae76"
}],
"name" : "my topic name",
"version" : "1.0.0-beta.1",
"title" : "example",
"status" : "draft",