Search in sources :

Example 66 with DateTimeType

use of org.hl7.fhir.r4b.model.DateTimeType in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ObservationUtilTest method mapEffectiveDateTimeUsingEffectiveCenter.

@Test
public void mapEffectiveDateTimeUsingEffectiveCenter() {
    var ehrExtract = unmarshallEhrExtractElement("effective_date_time_type_using_effective_time_center.xml");
    var observationStatement = getObservationStatementFromEhrExtract(ehrExtract);
    DateTimeType effective = (DateTimeType) ObservationUtil.getEffective(observationStatement.getEffectiveTime(), observationStatement.getAvailabilityTime());
    assertThat(effective.getValueAsString()).isEqualTo(EFFECTIVE_START_DATE_1);
}
Also used : DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Test(org.junit.jupiter.api.Test)

Example 67 with DateTimeType

use of org.hl7.fhir.r4b.model.DateTimeType in project bunsen by cerner.

the class TestData method newCondition.

/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {
    Condition condition = new Condition();
    // Condition based on example from FHIR:
    // https://www.hl7.org/fhir/condition-example.json.html
    condition.setId("Condition/example");
    condition.setLanguage("en_US");
    // Narrative text
    Narrative narrative = new Narrative();
    narrative.setStatusAsString("generated");
    narrative.setDivAsString("This data was generated for test purposes.");
    XhtmlNode node = new XhtmlNode();
    node.setNodeType(NodeType.Text);
    node.setValue("Severe burn of left ear (Date: 24-May 2012)");
    condition.setText(narrative);
    condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
    condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
    // Condition code
    CodeableConcept code = new CodeableConcept();
    code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
    condition.setSeverity(code);
    // Severity code
    CodeableConcept severity = new CodeableConcept();
    severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
    condition.setSeverity(severity);
    // Onset date time
    DateTimeType onset = new DateTimeType();
    onset.setValueAsString("2012-05-24");
    condition.setOnset(onset);
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Narrative(org.hl7.fhir.dstu3.model.Narrative) Reference(org.hl7.fhir.dstu3.model.Reference) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 68 with DateTimeType

use of org.hl7.fhir.r4b.model.DateTimeType in project bunsen by cerner.

the class TestData method newCondition.

/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {
    Condition condition = new Condition();
    // Condition based on example from FHIR:
    // https://www.hl7.org/fhir/condition-example.json.html
    condition.setId("Condition/example");
    condition.setLanguage("en_US");
    // Narrative text
    Narrative narrative = new Narrative();
    narrative.setStatusAsString("generated");
    narrative.setDivAsString("This data was generated for test purposes.");
    XhtmlNode node = new XhtmlNode();
    node.setNodeType(NodeType.Text);
    node.setValue("Severe burn of left ear (Date: 24-May 2012)");
    condition.setText(narrative);
    condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
    condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
    // Condition code
    CodeableConcept code = new CodeableConcept();
    code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
    condition.setSeverity(code);
    // Severity code
    CodeableConcept severity = new CodeableConcept();
    severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
    condition.setSeverity(severity);
    // Onset date time
    DateTimeType onset = new DateTimeType();
    onset.setValueAsString("2012-05-24");
    condition.setOnset(onset);
    return condition;
}
Also used : Condition(org.hl7.fhir.r4.model.Condition) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Narrative(org.hl7.fhir.r4.model.Narrative) Reference(org.hl7.fhir.r4.model.Reference) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 69 with DateTimeType

use of org.hl7.fhir.r4b.model.DateTimeType in project bunsen by cerner.

the class TestData method newCondition.

/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {
    Condition condition = new Condition();
    // Condition based on example from FHIR:
    // https://www.hl7.org/fhir/condition-example.json.html
    condition.setId("Condition/example");
    condition.setLanguage("en_US");
    // Narrative text
    Narrative narrative = new Narrative();
    narrative.setStatusAsString("generated");
    narrative.setDivAsString("This data was generated for test purposes.");
    XhtmlNode node = new XhtmlNode();
    node.setNodeType(NodeType.Text);
    node.setValue("Severe burn of left ear (Date: 24-May 2012)");
    condition.setText(narrative);
    condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
    condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
    // Condition code
    CodeableConcept code = new CodeableConcept();
    code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
    condition.setSeverity(code);
    // Severity code
    CodeableConcept severity = new CodeableConcept();
    severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
    condition.setSeverity(severity);
    // Onset date time
    DateTimeType onset = new DateTimeType();
    onset.setValueAsString("2012-05-24");
    condition.setOnset(onset);
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Narrative(org.hl7.fhir.dstu3.model.Narrative) Reference(org.hl7.fhir.dstu3.model.Reference) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 70 with DateTimeType

use of org.hl7.fhir.r4b.model.DateTimeType in project dpc-app by CMSgov.

the class Capabilities method buildCapabilities.

private static CapabilityStatement buildCapabilities(String baseURL) {
    final PropertiesProvider pp = new PropertiesProvider();
    DateTimeType releaseDate = DateTimeType.parseV3(pp.getBuildTimestamp().format(FHIRFormatters.DATE_TIME_FORMATTER));
    logger.debug("Reading {} from resources", CAP_STATEMENT);
    try (InputStream resource = Capabilities.class.getClassLoader().getResourceAsStream(CAP_STATEMENT)) {
        if (resource == null) {
            throw new MissingResourceException("Cannot find Capability Statement", Capabilities.class.getName(), CAP_STATEMENT);
        }
        final CapabilityStatement capabilityStatement = FhirContext.forDstu3().newJsonParser().parseResource(CapabilityStatement.class, resource);
        return capabilityStatement.setVersion(pp.getApplicationVersion()).setImplementation(generateImplementationComponent(baseURL)).setSoftware(generateSoftwareComponent(releaseDate, pp.getApplicationVersion()));
    } catch (IOException e) {
        throw new IllegalStateException("Unable to read capability statement", e);
    }
}
Also used : PropertiesProvider(gov.cms.dpc.common.utils.PropertiesProvider) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) InputStream(java.io.InputStream) MissingResourceException(java.util.MissingResourceException) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) IOException(java.io.IOException)

Aggregations

DateTimeType (org.hl7.fhir.r4.model.DateTimeType)65 Date (java.util.Date)28 Test (org.junit.Test)25 Coding (org.hl7.fhir.r4.model.Coding)23 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)18 Period (org.hl7.fhir.r4.model.Period)18 ArrayList (java.util.ArrayList)17 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)17 Observation (org.hl7.fhir.r4.model.Observation)16 Test (org.junit.jupiter.api.Test)16 Patient (org.hl7.fhir.r4.model.Patient)14 DateTimeType (org.hl7.fhir.r4b.model.DateTimeType)14 HashMap (java.util.HashMap)13 DateTimeType (org.hl7.fhir.r5.model.DateTimeType)13 NotImplementedException (org.apache.commons.lang3.NotImplementedException)12 Reference (org.hl7.fhir.r4.model.Reference)12 List (java.util.List)11 Reference (org.hl7.fhir.dstu3.model.Reference)11 FHIRException (org.hl7.fhir.exceptions.FHIRException)11 Resource (org.hl7.fhir.r4.model.Resource)11