Search in sources :

Example 1 with UriType

use of org.hl7.fhir.r4.model.UriType in project gpconnect-demonstrator by nhsconnect.

the class AppointmentResourceProvider method updateAppointment.

/**
 * amend or cancel an existing appointment
 *
 * @param appointmentId
 * @param appointment Resource
 * @param theRequest required to access the interaction id
 * @return MethodOutcome
 */
@Update
public MethodOutcome updateAppointment(@IdParam IdType appointmentId, @ResourceParam Appointment appointment, HttpServletRequest theRequest) {
    MethodOutcome methodOutcome = new MethodOutcome();
    OperationOutcome operationalOutcome = new OperationOutcome();
    AppointmentDetail appointmentDetail = appointmentResourceConverterToAppointmentDetail(appointment);
    Meta meta = appointment.getMeta();
    final List<UriType> profiles = meta.getProfile();
    // #203 validations
    VC.execute(new VC[] { new VC(() -> profiles.isEmpty(), () -> "Meta element must be present in Appointment"), new VC(() -> !profiles.get(0).getValue().equalsIgnoreCase(SD_GPC_APPOINTMENT), // what to do if > 1 meta profile element?
    () -> "Meta.profile " + profiles.get(0).getValue() + " is not equal to " + SD_GPC_APPOINTMENT), // #203
    new VC(() -> !appointment.getReason().isEmpty(), () -> "Appointment reason shouldn't be provided!"), new VC(() -> !appointment.getSpecialty().isEmpty(), () -> "Appointment speciality shouldn't be provided!"), // new VC(() -> !appointment.getServiceType().isEmpty(), () -> "Appointment service type shouldn't be provided!"),
    new VC(() -> !appointment.getAppointmentType().isEmpty(), () -> "Appointment type shouldn't be provided!"), new VC(() -> !appointment.getIndication().isEmpty(), () -> "Appointment indication shouldn't be provided!"), new VC(() -> !appointment.getSupportingInformation().isEmpty(), () -> "Appointment supporting information shouldn't be provided!"), new VC(() -> !appointment.getIncomingReferral().isEmpty(), () -> "Appointment incoming referral shouldn't be provided!") });
    // URL ID and Resource ID must be the same
    if (!Objects.equals(appointmentId.getIdPartAsLong(), appointmentDetail.getId())) {
        operationalOutcome.addIssue().setSeverity(IssueSeverity.ERROR).setDiagnostics("Id in URL (" + appointmentId.getIdPart() + ") should match Id in Resource (" + appointmentDetail.getId() + ")");
        methodOutcome.setOperationOutcome(operationalOutcome);
        return methodOutcome;
    }
    // Make sure there is an existing appointment to be amended
    AppointmentDetail oldAppointmentDetail = appointmentSearch.findAppointmentByID(appointmentId.getIdPartAsLong());
    if (oldAppointmentDetail == null) {
        operationalOutcome.addIssue().setSeverity(IssueSeverity.ERROR).setDiagnostics("No appointment details found for ID: " + appointmentId.getIdPart());
        methodOutcome.setOperationOutcome(operationalOutcome);
        return methodOutcome;
    }
    // 1.2.7 set the old service type and service category for comparison with incoming update/cancel content values
    SlotDetail slotDetail1 = slotSearch.findSlotByID(oldAppointmentDetail.getSlotIds().get(0));
    oldAppointmentDetail.setServiceType(slotDetail1.getTypeDisply());
    ScheduleDetail scheduleDetail = scheduleSearch.findScheduleByID(slotDetail1.getScheduleReference());
    oldAppointmentDetail.setServiceCategory(scheduleDetail.getTypeDescription());
    String oldAppointmentVersionId = String.valueOf(oldAppointmentDetail.getLastUpdated().getTime());
    String newAppointmentVersionId = appointmentId.getVersionIdPart();
    if (newAppointmentVersionId != null && !newAppointmentVersionId.equalsIgnoreCase(oldAppointmentVersionId)) {
        throw new ResourceVersionConflictException("The specified version (" + newAppointmentVersionId + ") did not match the current resource version (" + oldAppointmentVersionId + ")");
    }
    // check for absolute reference #200
    Iterator<AppointmentParticipantComponent> iter = appointment.getParticipant().iterator();
    while (iter.hasNext()) {
        AppointmentParticipantComponent participant = iter.next();
        if (participant.getActor() != null) {
            checkReferenceIsRelative(participant.getActor().getReference());
        }
    }
    String interactionId = theRequest.getHeader(SSP_INTERACTIONID);
    // Determine if it is a cancel or an amend. This was previously a check for the presence of a cancellation reason
    // but that is not sufficient. We can sefely assume that the interaction id is populated at this point.
    AppointmentOperation appointmentOperation = null;
    final AppointmentDetail fAppointmentDetail = appointmentDetail;
    switch(interactionId) {
        case REST_CANCEL_APPOINTMENT:
            appointmentOperation = AppointmentOperation.CANCEL;
            // added at 1.2.2
            VC.execute(new VC[] { new VC(() -> appointment.getStatus() != AppointmentStatus.CANCELLED, () -> "Status must be \"cancelled\""), // #203
            new VC(() -> isInThePast(fAppointmentDetail.getStartDateTime()), () -> "The cancellation start date cannot be in the past"), new VC(() -> fAppointmentDetail.getCancellationReason() == null, () -> "The cancellation reason must be provided"), // no point in this since fhir forbids empty elements
            new VC(() -> fAppointmentDetail.getCancellationReason().isEmpty(), () -> "The cancellation reason can not be blank") });
            validateAppointmentExtensions(appointment, profiles, appointmentOperation);
            // #172
            String appointmentType = appointment.getAppointmentType().getText();
            if (appointmentType != null) {
                throwUnprocessableEntity422_InvalidResourceException("The appointment type cannot be updated on a cancellation");
            }
            // This is a Cancellation - so copy across fields which can be
            // altered
            List cancelComparisonResult = compareAppointmentsForInvalidProperty(AppointmentOperation.CANCEL, oldAppointmentDetail, appointmentDetail);
            if (cancelComparisonResult.size() > 0) {
                throwUnprocessableEntity422_InvalidResourceException("Invalid Appointment property has been amended (cancellation) " + cancelComparisonResult);
            }
            oldAppointmentDetail.setCancellationReason(appointmentDetail.getCancellationReason());
            String oldStatus = oldAppointmentDetail.getStatus();
            appointmentDetail = oldAppointmentDetail;
            appointmentDetail.setStatus("cancelled");
            if (!"cancelled".equalsIgnoreCase(oldStatus)) {
                for (Long slotId : appointmentDetail.getSlotIds()) {
                    SlotDetail slotDetail = slotSearch.findSlotByID(slotId);
                    // slotDetail.setAppointmentId(null);
                    slotDetail.setFreeBusyType("FREE");
                    slotDetail.setLastUpdated(new Date());
                    slotStore.saveSlot(slotDetail);
                }
            }
            break;
        case REST_UPDATE_APPOINTMENT:
            appointmentOperation = AppointmentOperation.AMEND;
            VC.execute(new VC[] { new VC(() -> appointment.getStatus() != AppointmentStatus.BOOKED, () -> "Status must be \"booked\""), // this subsumes #161 which only inhibited amendment of the cancellation reason in an amend
            new VC(() -> fAppointmentDetail.getCancellationReason() != null, () -> "Cannot amend cancellation reason in appointment amend"), // added at 1.2.2
            new VC(() -> isInThePast(fAppointmentDetail.getStartDateTime()), () -> "The appointment amend start date cannot be in the past") });
            List amendComparisonResult = compareAppointmentsForInvalidProperty(AppointmentOperation.AMEND, oldAppointmentDetail, appointmentDetail);
            if (amendComparisonResult.size() > 0) {
                throwUnprocessableEntity422_InvalidResourceException("Invalid Appointment property has been amended " + amendComparisonResult);
            }
            validateAppointmentExtensions(appointment, profiles, appointmentOperation);
            // This is an Amend
            oldAppointmentDetail.setComment(appointmentDetail.getComment());
            oldAppointmentDetail.setDescription(appointmentDetail.getDescription());
            appointmentDetail = oldAppointmentDetail;
            break;
        default:
            System.err.println("AppointmentResourceProvider.updateAppointment Unhandled interaction id  " + interactionId);
    }
    // we'll get the delivery channel from the slot
    String deliveryChannel = null;
    String practitionerRoleCode = null;
    String practitionerRoleDisplay = null;
    ScheduleDetail schedule = null;
    // Common to both Update and cancel
    // slots valid?
    List<SlotDetail> slots = new ArrayList<>();
    for (Long slotId : appointmentDetail.getSlotIds()) {
        SlotDetail slotDetail = slotSearch.findSlotByID(slotId);
        if (slotDetail == null) {
            throwUnprocessableEntity422_InvalidResourceException("Slot resource reference is not a valid resource");
        }
        if (deliveryChannel == null) {
            deliveryChannel = slotDetail.getDeliveryChannelCode();
        }
        if (schedule == null) {
            // load the schedule so we can get the Practitioner ID
            schedule = scheduleSearch.findScheduleByID(slotDetail.getScheduleReference());
        }
        if (practitionerRoleDisplay == null) {
            practitionerRoleDisplay = schedule.getPractitionerRoleDisplay();
            practitionerRoleCode = schedule.getPractitionerRoleCode();
        }
        slots.add(slotDetail);
    }
    validateUpdateExtensions(deliveryChannel, practitionerRoleDisplay, practitionerRoleCode, appointment.getExtension());
    // dates valid?
    // #203
    Date firstSlotStart = slots.get(0).getStartDateTime();
    Date lastSlotEnd = slots.get(slots.size() - 1).getEndDateTime();
    // need to insert a colon in the timezone string
    String firstSlotStartStr = TIMESTAMP_FORMAT.format(firstSlotStart).replaceFirst("([0-9]{2})([0-9]{2})$", "$1:$2");
    String lastSlotEndStr = TIMESTAMP_FORMAT.format(lastSlotEnd).replaceFirst("([0-9]{2})([0-9]{2})$", "$1:$2");
    VC.execute(new VC[] { new VC(() -> appointment.getStart().compareTo(firstSlotStart) != 0, () -> String.format("Start date '%s' must match start date of first slot '%s'", appointment.getStart(), firstSlotStart)), new VC(() -> appointment.getEnd().compareTo(lastSlotEnd) != 0, () -> String.format("End date '%s' must match end date of last slot '%s'", appointment.getEnd(), lastSlotEnd)), // #218 strings should match exactly
    new VC(() -> !appointment.getStartElement().getValueAsString().equals(firstSlotStartStr), () -> String.format("Start date '%s' must lexically match start date of first slot '%s'", appointment.getStartElement().getValueAsString(), firstSlotStartStr)), new VC(() -> !appointment.getEndElement().getValueAsString().equals(lastSlotEndStr), () -> String.format("End date '%s' must lexically match end date of last slot '%s'", appointment.getEndElement().getValueAsString(), lastSlotEndStr)), new VC(() -> appointment.getSlot().size() != slots.size(), () -> String.format("Slot count mismatch %d provided appointment has %d", appointment.getSlot().size(), slots.size())) });
    // check the slots match
    HashSet<String> hs = new HashSet<>();
    for (SlotDetail slotDetail : slots) {
        hs.add("Slot/" + slotDetail.getId());
    }
    for (Reference reference : appointment.getSlot()) {
        if (!hs.contains(reference.getReference())) {
            throwUnprocessableEntity422_InvalidResourceException(String.format("Provided slot id %s does not exist in booked appointment", reference.getReference()));
        }
    }
    // Update version and
    appointmentDetail.setLastUpdated(new Date());
    // lastUpdated timestamp
    appointmentDetail = appointmentStore.saveAppointment(appointmentDetail, slots);
    methodOutcome.setId(new IdDt("Appointment", appointmentDetail.getId()));
    methodOutcome.setResource(appointmentDetailToAppointmentResourceConverter(appointmentDetail));
    return methodOutcome;
}
Also used : AppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent) AppointmentDetail(uk.gov.hscic.model.appointment.AppointmentDetail) IdDt(ca.uhn.fhir.model.primitive.IdDt) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) VC(uk.gov.hscic.common.validators.VC) ScheduleDetail(uk.gov.hscic.model.appointment.ScheduleDetail) SlotDetail(uk.gov.hscic.model.appointment.SlotDetail)

Example 2 with UriType

use of org.hl7.fhir.r4.model.UriType in project bunsen by cerner.

the class ConceptMaps method expandMappingsIterator.

private static Iterator<Mapping> expandMappingsIterator(ConceptMap map) {
    List<Mapping> mappings = new ArrayList<>();
    for (ConceptMapGroupComponent group : map.getGroup()) {
        for (SourceElementComponent element : group.getElement()) {
            for (TargetElementComponent target : element.getTarget()) {
                Mapping mapping = new Mapping();
                mapping.setConceptMapUri(map.getUrl());
                mapping.setConceptMapVersion(map.getVersion());
                try {
                    String sourceValue = map.getSource() instanceof UriType ? map.getSourceUriType().getValue() : map.getSourceReference().getReference();
                    mapping.setSourceValueSet(sourceValue);
                    String targetValue = map.getTarget() instanceof UriType ? map.getTargetUriType().getValue() : map.getTargetReference().getReference();
                    mapping.setTargetValueSet(targetValue);
                } catch (FHIRException fhirException) {
                    // an exception.
                    throw new RuntimeException(fhirException);
                }
                mapping.setSourceSystem(group.getSource());
                mapping.setSourceValue(element.getCode());
                mapping.setTargetSystem(group.getTarget());
                mapping.setTargetValue(target.getCode());
                if (target.getEquivalence() != null) {
                    mapping.setEquivalence(target.getEquivalence().toCode());
                }
                mappings.add(mapping);
            }
        }
    }
    return mappings.iterator();
}
Also used : ArrayList(java.util.ArrayList) TargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent) FHIRException(org.hl7.fhir.exceptions.FHIRException) ConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent) SourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent) UriType(org.hl7.fhir.dstu3.model.UriType)

Example 3 with UriType

use of org.hl7.fhir.r4.model.UriType in project bunsen by cerner.

the class BroadcastableMappingsTest method setUp.

/**
 * Sets up Spark and concept maps for testing.
 */
@BeforeClass
public static void setUp() {
    spark = SparkSession.builder().master("local[2]").appName("BroadcastableMappingsTest").getOrCreate();
    ConceptMap conceptMap = new ConceptMap();
    conceptMap.setUrl("uri:test:concept:map").setVersion("0").setSource(new UriType("uri:test:source:valueset")).setTarget(new UriType("uri:test:target:valueset"));
    ConceptMapGroupComponent group = conceptMap.addGroup().setSource("uri:test:source:system").setTarget("uri:test:target:system");
    group.addElement().setCode("abc").addTarget().setCode("123");
    group.addElement().setCode("def").addTarget().setCode("456");
    ConceptMap delegatingMap = new ConceptMap();
    delegatingMap.setUrl("uri:test:concept:delegating").setVersion("0").setSource(new UriType("uri:test:source:valueset")).setTarget(new UriType("uri:test:target:valueset"));
    delegatingMap.addGroup().setSource("uri:test:source:system").setTarget("uri:test:target:system").setUnmapped(new ConceptMapGroupUnmappedComponent().setMode(ConceptMapGroupUnmappedMode.OTHERMAP).setUrl("uri:test:concept:map"));
    broadcast = BroadcastableMappings.broadcast(spark, ImmutableList.of(conceptMap, delegatingMap));
}
Also used : ConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent) ConceptMap(org.hl7.fhir.dstu3.model.ConceptMap) ConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent) UriType(org.hl7.fhir.dstu3.model.UriType) BeforeClass(org.junit.BeforeClass)

Example 4 with UriType

use of org.hl7.fhir.r4.model.UriType in project kindling by HL7.

the class Publisher method checkElement.

private void checkElement(StructureDefinition sd, ElementDefinition ed, boolean inDiff) {
    check(ed.hasPath(), sd, "Element has no path");
    Set<String> codes = new HashSet<String>();
    for (TypeRefComponent tr : ed.getType()) {
        String tc = tr.getWorkingCode();
        if (codes.contains(tc))
            check(false, sd, ed.getPath() + ": type '" + tc + "' is duplicated");
        if ((!inDiff || tr.hasCode()) && tc != null)
            if (ed.getPath().contains("."))
                check(page.getDefinitions().hasBaseType(tc) || tc.equals("Resource"), sd, ed.getPath() + ": type '" + tc + "' is not valid (a)");
            else if (sd.hasBaseDefinition()) {
                if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT)
                    check(page.getDefinitions().hasConcreteResource(tc) || page.getDefinitions().hasBaseType(tc), sd, ed.getPath() + ": type '" + tc + "' is not valid (b)");
                else
                    check(page.getDefinitions().hasAbstractResource(tc) || tc.equals("Element"), sd, ed.getPath() + ": type '" + tc + "' is not valid (c)");
            }
        if (tr.hasProfile()) {
            check(tr.getProfile().size() == 1, sd, ed.getPath() + ": multiple profiles found: " + tr.getProfile());
            String pt = tr.getProfile().get(0).getValue();
            if (pt.contains("#")) {
                String[] parts = pt.split("\\#");
                StructureDefinition exd = page.getWorkerContext().fetchResource(StructureDefinition.class, parts[0]);
                if (exd == null)
                    check(false, sd, ed.getPath() + ": profile '" + pt + "' is not valid (definition not found)");
                else {
                    ElementDefinition ex = null;
                    for (ElementDefinition et : exd.getSnapshot().getElement()) if (et.hasFixed() && et.getFixed() instanceof UriType && ((UriType) et.getFixed()).asStringValue().equals(parts[1]))
                        ex = et;
                    check(ex != null, sd, ed.getPath() + ": profile '" + pt + "' is not valid (inner path not found)");
                }
            } else
                check((page.getWorkerContext().hasResource(StructureDefinition.class, pt)) || isStringPattern(tail(pt)), sd, ed.getPath() + ": profile '" + pt + "' is not valid (d)");
        }
        if (tr.hasTargetProfile()) {
            String pt = tr.getTargetProfile().get(0).getValue();
            if (pt.contains("#")) {
                String[] parts = pt.split("\\#");
                StructureDefinition exd = page.getWorkerContext().fetchResource(StructureDefinition.class, parts[0]);
                if (exd == null)
                    check(false, sd, ed.getPath() + ": target profile '" + pt + "' is not valid (definition not found)");
                else {
                    ElementDefinition ex = null;
                    for (ElementDefinition et : exd.getSnapshot().getElement()) if (et.hasFixed() && et.getFixed() instanceof UriType && ((UriType) et.getFixed()).asStringValue().equals(parts[1]))
                        ex = et;
                    check(ex != null, sd, ed.getPath() + ": target profile '" + pt + "' is not valid (inner path not found)");
                }
            } else
                check((page.getWorkerContext().hasResource(StructureDefinition.class, pt)) || isStringPattern(tail(pt)), sd, ed.getPath() + ": target profile '" + pt + "' is not valid (d)");
        }
    }
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) HashSet(java.util.HashSet) UriType(org.hl7.fhir.r5.model.UriType)

Example 5 with UriType

use of org.hl7.fhir.r4.model.UriType in project kindling by HL7.

the class PageProcessor method generateValueSetUsage.

private String generateValueSetUsage(ValueSet vs, String prefix, boolean addTitle) throws Exception {
    List<String> items = new ArrayList<>();
    if (vs.hasUrl()) {
        for (CodeSystem cs : getCodeSystems().getList()) {
            if (cs != null) {
                if (vs.getUrl().equals(cs.getValueSet())) {
                    String p = cs.getUserString("path");
                    addItem(items, "<li>CodeSystem: This value set is the designated 'entire code system' value set for <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cs.getName() + "</a> " + "</li>\r\n");
                }
            }
        }
    }
    for (ConceptMap cm : getConceptMaps().getList()) {
        String p = cm.getUserString("path");
        if (cm.hasSourceUriType() && cm.getSourceUriType().equals(vs.getUrl())) {
            addItem(items, "<li>ConceptMap: Translation source in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.present() + "</a> " + "</li>\r\n");
        } else if (cm.hasSourceCanonicalType() && (cm.getSourceCanonicalType().getValue().equals(vs.getUrl()) || vs.getUrl().endsWith("/" + cm.getSourceCanonicalType().getValue()))) {
            addItem(items, "<li>ConceptMap: Translation source in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.getName() + "</a> " + "</li>\r\n");
        }
    }
    for (ConceptMap cm : getConceptMaps().getList()) {
        String p = cm.getUserString("path");
        if (cm.hasTargetUriType() && cm.getTargetUriType().equals(vs.getUrl())) {
            addItem(items, "<li>ConceptMap: Translation target in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.present() + "</a> " + "</li>\r\n");
        } else if (cm.hasTargetCanonicalType() && (cm.getTargetCanonicalType().getValue().equals(vs.getUrl()) || vs.getUrl().endsWith("/" + cm.getTargetCanonicalType().getValue()))) {
            addItem(items, "<li>ConceptMap: Translation target ConceptMap <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.getName() + "</a> " + "</li>\r\n");
        }
    }
    for (ResourceDefn r : definitions.getBaseResources().values()) {
        scanForUsage(items, vs, r.getRoot(), r.getName().toLowerCase() + "-definitions.html", prefix);
        scanForOperationUsage(items, vs, r, r.getName().toLowerCase() + "-operation-", prefix);
        scanForProfileUsage(items, vs, r, prefix);
    }
    for (ResourceDefn r : definitions.getResources().values()) {
        scanForUsage(items, vs, r.getRoot(), r.getName().toLowerCase() + "-definitions.html", prefix);
        scanForOperationUsage(items, vs, r, r.getName().toLowerCase() + "-operation-", prefix);
        scanForProfileUsage(items, vs, r, prefix);
    }
    for (ElementDefn e : definitions.getInfrastructure().values()) {
        scanForUsage(items, vs, e, definitions.getSrcFile(e.getName()) + "-definitions.html", prefix);
    }
    for (ElementDefn e : definitions.getTypes().values()) {
        if (!definitions.dataTypeIsSharedInfo(e.getName())) {
            scanForUsage(items, vs, e, definitions.getSrcFile(e.getName()) + "-definitions.html", prefix);
        }
    }
    for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
        scanForUsage(items, vs, sd, sd.getUserString("path"), prefix);
    }
    for (ValueSet vsi : definitions.getValuesets().getList()) {
        String path = (String) vsi.getUserData("path");
        if (vs.hasCompose()) {
            for (ConceptSetComponent t : vs.getCompose().getInclude()) {
                for (UriType uri : t.getValueSet()) {
                    if (uri.getValue().equals(vs.getUrl())) {
                        addItem(items, "<li>ValueSet: Included in <a href=\"" + prefix + path + "\">" + Utilities.escapeXml(vs.present()) + "</a></li>\r\n");
                    }
                }
            }
            for (ConceptSetComponent t : vs.getCompose().getExclude()) {
                for (UriType uri : t.getValueSet()) {
                    if (uri.getValue().equals(vs.getUrl())) {
                        addItem(items, "<li>ValueSet: Excluded from  <a href=\"" + prefix + path + "\">" + Utilities.escapeXml(vs.present()) + "</a></li>\r\n");
                    }
                }
            }
        // for (ConceptSetComponent t : vsi.getCompose().getInclude()) {
        // if (vs.hasCodeSystem() && t.getSystem().equals(vs.getCodeSystem().getSystem()))
        // b.append(" <li>Included in Valueset <a href=\""+prefix+path+"\">"+Utilities.escapeXml(vs.getName())+"</a></li>\r\n");
        // }
        // for (ConceptSetComponent t : vsi.getCompose().getExclude()) {
        // if (vs.hasCodeSystem() && t.getSystem().equals(vs.getCodeSystem().getSystem()))
        // b.append(" <li>Excluded in Valueset <a href=\""+prefix+path+"\">"+Utilities.escapeXml(vs.getName())+"</a></li>\r\n");
        // }
        }
    }
    if (ini.getPropertyNames(vs.getUrl()) != null) {
        for (String n : ini.getPropertyNames(vs.getUrl())) {
            addItem(items, "<li>" + ini.getStringProperty(vs.getUrl(), n) + "</li>\r\n");
        }
    }
    if (items.size() == 0)
        return "<p>\r\nThis value set is not currently used\r\n</p>\r\n";
    else {
        StringBuilder b = new StringBuilder();
        for (String s : items) {
            b.append(" " + s);
        }
        return (addTitle ? "<p>\r\nThis value set is used in the following places:\r\n</p>\r\n" : "") + "<ul>\r\n" + b.toString() + "</ul>\r\n";
    }
}
Also used : ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ArrayList(java.util.ArrayList) ElementDefn(org.hl7.fhir.definitions.model.ElementDefn) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) CodeSystem(org.hl7.fhir.r5.model.CodeSystem) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn) ValueSet(org.hl7.fhir.r5.model.ValueSet) UriType(org.hl7.fhir.r5.model.UriType)

Aggregations

FHIRException (org.hl7.fhir.exceptions.FHIRException)60 UriType (org.hl7.fhir.r5.model.UriType)45 ArrayList (java.util.ArrayList)42 UriType (org.hl7.fhir.r4.model.UriType)40 UriType (org.hl7.fhir.r4b.model.UriType)29 UriType (org.hl7.fhir.dstu3.model.UriType)26 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)24 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)22 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)19 List (java.util.List)17 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)16 NotImplementedException (org.apache.commons.lang3.NotImplementedException)15 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)14 UriType (org.hl7.fhir.dstu2016may.model.UriType)12 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)12 IOException (java.io.IOException)11 Coding (org.hl7.fhir.r4.model.Coding)11 org.hl7.fhir.r5.model (org.hl7.fhir.r5.model)10 StringType (org.hl7.fhir.r5.model.StringType)10 HashMap (java.util.HashMap)9