Search in sources :

Example 1 with EventTiming

use of org.hl7.fhir.dstu2016may.model.Timing.EventTiming in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeTriggerDefinition.

protected void composeTriggerDefinition(Complex parent, String parentType, String name, TriggerDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeElement(t, "TriggerDefinition", name, element, index);
    if (element.hasTypeElement())
        composeEnum(t, "TriggerDefinition", "type", element.getTypeElement(), -1);
    if (element.hasEventNameElement())
        composeString(t, "TriggerDefinition", "eventName", element.getEventNameElement(), -1);
    if (element.hasEventTiming())
        composeType(t, "TriggerDefinition", "eventTiming", element.getEventTiming(), -1);
    if (element.hasEventData())
        composeDataRequirement(t, "TriggerDefinition", "eventData", element.getEventData(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 2 with EventTiming

use of org.hl7.fhir.dstu2016may.model.Timing.EventTiming in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayTiming.

private String displayTiming(Timing s) throws FHIRException {
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (s.hasCode())
        b.append("Code: " + displayCodeableConcept(s.getCode()));
    if (s.getEvent().size() > 0) {
        CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
        for (DateTimeType p : s.getEvent()) {
            c.append(p.toHumanDisplay());
        }
        b.append("Events: " + c.toString());
    }
    if (s.hasRepeat()) {
        TimingRepeatComponent rep = s.getRepeat();
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasStart())
            b.append("Starting " + rep.getBoundsPeriod().getStartElement().toHumanDisplay());
        if (rep.hasCount())
            b.append("Count " + Integer.toString(rep.getCount()) + " times");
        if (rep.hasDuration())
            b.append("Duration " + rep.getDuration().toPlainString() + displayTimeUnits(rep.getPeriodUnit()));
        if (rep.hasWhen()) {
            String st = "";
            if (rep.hasOffset()) {
                st = Integer.toString(rep.getOffset()) + "min ";
            }
            b.append("Do " + st);
            for (Enumeration<EventTiming> wh : rep.getWhen()) b.append(displayEventCode(wh.getValue()));
        } else {
            String st = "";
            if (!rep.hasFrequency() || (!rep.hasFrequencyMax() && rep.getFrequency() == 1))
                st = "Once";
            else {
                st = Integer.toString(rep.getFrequency());
                if (rep.hasFrequencyMax())
                    st = st + "-" + Integer.toString(rep.getFrequency());
            }
            if (rep.hasPeriod()) {
                st = st + " per " + rep.getPeriod().toPlainString();
                if (rep.hasPeriodMax())
                    st = st + "-" + rep.getPeriodMax().toPlainString();
                st = st + " " + displayTimeUnits(rep.getPeriodUnit());
            }
            b.append("Do " + st);
        }
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasEnd())
            b.append("Until " + rep.getBoundsPeriod().getEndElement().toHumanDisplay());
    }
    return b.toString();
}
Also used : EventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent)

Example 3 with EventTiming

use of org.hl7.fhir.dstu2016may.model.Timing.EventTiming in project org.hl7.fhir.core by hapifhir.

the class DataRenderer method displayTiming.

private String displayTiming(Timing s) throws FHIRException {
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (s.hasCode())
        b.append("Code: " + displayCodeableConcept(s.getCode()));
    if (s.getEvent().size() > 0) {
        CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
        for (DateTimeType p : s.getEvent()) {
            if (p.hasValue()) {
                c.append(displayDateTime(p));
            } else if (!renderExpression(c, p)) {
                c.append("??");
            }
        }
        b.append("Events: " + c.toString());
    }
    if (s.hasRepeat()) {
        TimingRepeatComponent rep = s.getRepeat();
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasStart())
            b.append("Starting " + displayDateTime(rep.getBoundsPeriod().getStartElement()));
        if (rep.hasCount())
            b.append("Count " + Integer.toString(rep.getCount()) + " times");
        if (rep.hasDuration())
            b.append("Duration " + rep.getDuration().toPlainString() + displayTimeUnits(rep.getPeriodUnit()));
        if (rep.hasWhen()) {
            String st = "";
            if (rep.hasOffset()) {
                st = Integer.toString(rep.getOffset()) + "min ";
            }
            b.append("Do " + st);
            for (Enumeration<EventTiming> wh : rep.getWhen()) b.append(displayEventCode(wh.getValue()));
        } else {
            String st = "";
            if (!rep.hasFrequency() || (!rep.hasFrequencyMax() && rep.getFrequency() == 1))
                st = "Once";
            else {
                st = Integer.toString(rep.getFrequency());
                if (rep.hasFrequencyMax())
                    st = st + "-" + Integer.toString(rep.getFrequency());
            }
            if (rep.hasPeriod()) {
                st = st + " per " + rep.getPeriod().toPlainString();
                if (rep.hasPeriodMax())
                    st = st + "-" + rep.getPeriodMax().toPlainString();
                st = st + " " + displayTimeUnits(rep.getPeriodUnit());
            }
            b.append("Do " + st);
        }
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasEnd())
            b.append("Until " + displayDateTime(rep.getBoundsPeriod().getEndElement()));
    }
    return b.toString();
}
Also used : EventTiming(org.hl7.fhir.r5.model.Timing.EventTiming) DateTimeType(org.hl7.fhir.r5.model.DateTimeType) BaseDateTimeType(org.hl7.fhir.r5.model.BaseDateTimeType) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent)

Example 4 with EventTiming

use of org.hl7.fhir.dstu2016may.model.Timing.EventTiming in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeTriggerDefinition.

protected void composeTriggerDefinition(Complex parent, String parentType, String name, TriggerDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeElement(t, "TriggerDefinition", name, element, index);
    if (element.hasTypeElement())
        composeEnum(t, "TriggerDefinition", "type", element.getTypeElement(), -1);
    if (element.hasEventNameElement())
        composeString(t, "TriggerDefinition", "eventName", element.getEventNameElement(), -1);
    if (element.hasEventTiming())
        composeType(t, "TriggerDefinition", "eventTiming", element.getEventTiming(), -1);
    if (element.hasEventData())
        composeDataRequirement(t, "TriggerDefinition", "eventData", element.getEventData(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 5 with EventTiming

use of org.hl7.fhir.dstu2016may.model.Timing.EventTiming in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayTiming.

private String displayTiming(Timing s) throws FHIRException {
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (s.hasCode())
        b.append("Code: " + displayCodeableConcept(s.getCode()));
    if (s.getEvent().size() > 0) {
        CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
        for (DateTimeType p : s.getEvent()) {
            c.append(p.toHumanDisplay());
        }
        b.append("Events: " + c.toString());
    }
    if (s.hasRepeat()) {
        TimingRepeatComponent rep = s.getRepeat();
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasStart())
            b.append("Starting " + rep.getBoundsPeriod().getStartElement().toHumanDisplay());
        if (rep.hasCount())
            b.append("Count " + Integer.toString(rep.getCount()) + " times");
        if (rep.hasDuration())
            b.append("Duration " + rep.getDuration().toPlainString() + displayTimeUnits(rep.getPeriodUnit()));
        if (rep.hasWhen()) {
            String st = "";
            if (rep.hasOffset()) {
                st = Integer.toString(rep.getOffset()) + "min ";
            }
            b.append("Do " + st);
            for (Enumeration<EventTiming> wh : rep.getWhen()) b.append(displayEventCode(wh.getValue()));
        } else {
            String st = "";
            if (!rep.hasFrequency() || (!rep.hasFrequencyMax() && rep.getFrequency() == 1))
                st = "Once";
            else {
                st = Integer.toString(rep.getFrequency());
                if (rep.hasFrequencyMax())
                    st = st + "-" + Integer.toString(rep.getFrequency());
            }
            if (rep.hasPeriod()) {
                st = st + " per " + rep.getPeriod().toPlainString();
                if (rep.hasPeriodMax())
                    st = st + "-" + rep.getPeriodMax().toPlainString();
                st = st + " " + displayTimeUnits(rep.getPeriodUnit());
            }
            b.append("Do " + st);
        }
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasEnd())
            b.append("Until " + rep.getBoundsPeriod().getEndElement().toHumanDisplay());
    }
    return b.toString();
}
Also used : EventTiming(org.hl7.fhir.r4.model.Timing.EventTiming) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent)

Aggregations

CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)1 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)1 EventTiming (org.hl7.fhir.dstu3.model.Timing.EventTiming)1 TimingRepeatComponent (org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent)1 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)1 EventTiming (org.hl7.fhir.r4.model.Timing.EventTiming)1 TimingRepeatComponent (org.hl7.fhir.r4.model.Timing.TimingRepeatComponent)1 BaseDateTimeType (org.hl7.fhir.r4b.model.BaseDateTimeType)1 DateTimeType (org.hl7.fhir.r4b.model.DateTimeType)1 EventTiming (org.hl7.fhir.r4b.model.Timing.EventTiming)1 TimingRepeatComponent (org.hl7.fhir.r4b.model.Timing.TimingRepeatComponent)1 BaseDateTimeType (org.hl7.fhir.r5.model.BaseDateTimeType)1 DateTimeType (org.hl7.fhir.r5.model.DateTimeType)1 EventTiming (org.hl7.fhir.r5.model.Timing.EventTiming)1 TimingRepeatComponent (org.hl7.fhir.r5.model.Timing.TimingRepeatComponent)1