Search in sources :

Example 11 with Type

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

the class SlotResourceProvider method getSlotsForScheduleIdNoOrganizationTypeOrODS.

/**
 * returns any slots not having org type or org id assigned
 *
 * @param scheduleId
 * @param startDateTime
 * @param endDateTime
 * @return
 */
public List<Slot> getSlotsForScheduleIdNoOrganizationTypeOrODS(String scheduleId, Date startDateTime, Date endDateTime) {
    ArrayList<Slot> slots = new ArrayList<>();
    List<SlotDetail> slotDetails = slotSearch.findSlotsForScheduleIdNoOrganizationTypeOrODS(Long.valueOf(scheduleId), startDateTime, endDateTime);
    if (slotDetails != null && !slotDetails.isEmpty()) {
        for (SlotDetail slotDetail : slotDetails) {
            slots.add(slotDetailToSlotResourceConverter(slotDetail));
        }
    }
    return slots;
}
Also used : ArrayList(java.util.ArrayList) Slot(org.hl7.fhir.dstu3.model.Slot) SlotDetail(uk.gov.hscic.model.appointment.SlotDetail)

Example 12 with Type

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

the class SlotResourceProvider method slotDetailToSlotResourceConverter.

private Slot slotDetailToSlotResourceConverter(SlotDetail slotDetail) {
    Slot slot = new Slot();
    Date lastUpdated = slotDetail.getLastUpdated() == null ? new Date() : slotDetail.getLastUpdated();
    String resourceId = String.valueOf(slotDetail.getId());
    String versionId = String.valueOf(lastUpdated.getTime());
    IdType id = new IdType(resourceId);
    slot.setId(id);
    slot.getMeta().setVersionId(versionId);
    slot.getMeta().addProfile(SystemURL.SD_GPC_SLOT);
    slot.setSchedule(new Reference("Schedule/" + slotDetail.getScheduleReference()));
    slot.setStart(slotDetail.getStartDateTime());
    slot.setEnd(slotDetail.getEndDateTime());
    // #218 Date time formats
    slot.getStartElement().setPrecision(TemporalPrecisionEnum.SECOND);
    slot.getEndElement().setPrecision(TemporalPrecisionEnum.SECOND);
    switch(slotDetail.getFreeBusyType().toLowerCase(Locale.UK)) {
        case "free":
            slot.setStatus(SlotStatus.FREE);
            break;
        default:
            slot.setStatus(SlotStatus.BUSY);
            break;
    }
    String deliveryChannelCode = slotDetail.getDeliveryChannelCode();
    ArrayList<Extension> al = new ArrayList<>();
    if (deliveryChannelCode != null && !deliveryChannelCode.trim().isEmpty()) {
        Extension deliveryChannelExtension = new Extension(SystemURL.SD_EXTENSION_GPC_DELIVERY_CHANNEL, new CodeType(deliveryChannelCode));
        al.add(deliveryChannelExtension);
    }
    slot.setExtension(al);
    // 1.2.7 add slot type description as service type
    slot.addServiceType(new CodeableConcept().setText(slotDetail.getTypeDisply()));
    return slot;
}
Also used : Extension(org.hl7.fhir.dstu3.model.Extension) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Slot(org.hl7.fhir.dstu3.model.Slot) CodeType(org.hl7.fhir.dstu3.model.CodeType) Date(java.util.Date) IdType(org.hl7.fhir.dstu3.model.IdType) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 13 with Type

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

the class AppointmentValidation method validateParticipantType.

/**
 * This method is effectively disabled since we dont check against value sets
 * This was experimental code that never worked correctly.
 * @param participantType
 * @return
 */
public Boolean validateParticipantType(CodeableConcept participantType) {
    Boolean hasCode = !participantType.isEmpty();
    Coding code = participantType.getCodingFirstRep();
    Boolean isValid = !hasCode;
    if (hasCode) {
        // isValid = valueSetValidator.validateCode(code);
        isValid = true;
        if (!isValid) {
            throwUnprocessableEntity422_InvalidResourceException(MessageFormat.format("Invalid Participant Type Code. Code: {0} [Display: {1}, System:{2}]", code.getCode(), code.getDisplay(), code.getSystem()));
        }
    }
    return isValid;
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding)

Example 14 with Type

use of org.hl7.fhir.r4.model.Type in project uPMT by coco35700.

the class Main method createBasicSchema.

/**
 * Creates a basic scheme as a default
 * should be improved if desired
 */
private void createBasicSchema() {
    Type s = new Schema((_langBundle.getString("default_scheme")));
    Type general = new Folder(_langBundle.getString("general"));
    Type autre = new Folder(_langBundle.getString("other"));
    Type visuel = new Category(_langBundle.getString("visual"));
    Type image = new Property(_langBundle.getString("picture"));
    Type sensoriel = new Category(_langBundle.getString("sensory"));
    Type emotionnel = new Category(_langBundle.getString("emotional"));
    Type sonore = new Category(_langBundle.getString("acoustic"));
    visuel.addType(image);
    general.addType(visuel);
    general.addType(sensoriel);
    general.addType(emotionnel);
    general.addType(sonore);
    s.addType(general);
    s.addType(autre);
    this.BasicSchema = (Schema) s;
}
Also used : AlertType(javafx.scene.control.Alert.AlertType) ButtonType(javafx.scene.control.ButtonType) Type(model.Type) Category(model.Category) Schema(model.Schema) Folder(model.Folder) Property(model.Property)

Example 15 with Type

use of org.hl7.fhir.r4.model.Type in project uPMT by coco35700.

the class Main method writeMoment.

/**
 * Recursive method used to recursively transform a Moment and its sub Moments into CSV compatible DATAZ
 */
private void writeMoment(DescriptionInterview ent, MomentExperience m, PrintWriter writer, String hierarchy) {
    LinkedList<String> classes = new LinkedList<String>();
    for (Type t : m.getTypes()) {
        for (Type prop : t.getTypes()) {
            Property p = (Property) prop;
            classes.add(format(t.getName()) + "," + format(p.getName()) + "," + format(p.getValue()));
        }
    }
    if (!classes.isEmpty()) {
        for (String s : classes) {
            writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + "," + s);
        }
    } else {
        writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + ",\"\",\"\",\"\"");
    }
    for (int i = 0; i < m.getSubMoments().size(); i++) {
        MomentExperience sub = m.getSubMoments().get(i);
        writeMoment(ent, sub, writer, hierarchy + "." + (i + 1));
    }
}
Also used : AlertType(javafx.scene.control.Alert.AlertType) ButtonType(javafx.scene.control.ButtonType) Type(model.Type) MomentExperience(model.MomentExperience) Property(model.Property) LinkedList(java.util.LinkedList)

Aggregations

ArrayList (java.util.ArrayList)239 FHIRException (org.hl7.fhir.exceptions.FHIRException)181 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)168 Test (org.junit.jupiter.api.Test)133 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)106 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)105 IOException (java.io.IOException)93 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)93 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)90 List (java.util.List)87 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)79 HashMap (java.util.HashMap)76 Coding (org.hl7.fhir.r4.model.Coding)76 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)72 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)69 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)59 Resource (org.hl7.fhir.r4.model.Resource)58 Identifier (org.hl7.fhir.r4.model.Identifier)57 HashSet (java.util.HashSet)54 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)52