Search in sources :

Example 26 with CodeableConcept

use of org.hl7.fhir.r4.model.CodeableConcept in project loinc2hpo by monarch-initiative.

the class ObservationDtu3 method getOutcomeFromCodedValue.

Optional<Outcome> getOutcomeFromCodedValue() {
    CodeableConcept codeableConcept = this.observation.getValueCodeableConcept();
    if (codeableConcept == null) {
        // should never happen
        LOGGER.error("Codable concept null in getOutcomeFromCodedValue");
    }
    List<Coding> codings = codeableConcept != null ? codeableConcept.getCoding() : List.of();
    for (Coding coding : codings) {
        String code = coding.getCode();
        String system = coding.getSystem();
        String display = coding.getDisplay();
        String outcomeString = code + ":" + system + ":" + display;
        Outcome outcome = Outcome.nominal(outcomeString);
        return Optional.of(outcome);
    }
    return Optional.empty();
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 27 with CodeableConcept

use of org.hl7.fhir.r4.model.CodeableConcept in project loinc2hpo by monarch-initiative.

the class ObservationR5 method getOutcomeFromCodedValue.

Optional<Outcome> getOutcomeFromCodedValue() {
    CodeableConcept codeableConcept = this.observation.getValueCodeableConcept();
    if (codeableConcept == null) {
        // should never happen
        LOGGER.error("Codable concept null in getOutcomeFromCodedValue");
    }
    List<Coding> codings = codeableConcept != null ? codeableConcept.getCoding() : List.of();
    for (Coding coding : codings) {
        String code = coding.getCode();
        String system = coding.getSystem();
        String display = coding.getDisplay();
        String outcomeString = code + ":" + system + ":" + display;
        Outcome outcome = Outcome.nominal(outcomeString);
        return Optional.of(outcome);
    }
    return Optional.empty();
}
Also used : Coding(org.hl7.fhir.r5.model.Coding) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept)

Example 28 with CodeableConcept

use of org.hl7.fhir.r4.model.CodeableConcept in project loinc2hpo by monarch-initiative.

the class ObservationR4 method getOutcomeFromCodedValue.

Optional<Outcome> getOutcomeFromCodedValue() {
    CodeableConcept codeableConcept = this.observation.getValueCodeableConcept();
    if (codeableConcept == null) {
        // should never happen
        LOGGER.error("Codable concept null in getOutcomeFromCodedValue");
    }
    List<Coding> codings = codeableConcept != null ? codeableConcept.getCoding() : List.of();
    for (Coding coding : codings) {
        String code = coding.getCode();
        String system = coding.getSystem();
        String display = coding.getDisplay();
        String outcomeString = code + ":" + system + ":" + display;
        Outcome outcome = Outcome.nominal(outcomeString);
        return Optional.of(outcome);
    }
    return Optional.empty();
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Aggregations

CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)16 Coding (org.hl7.fhir.dstu3.model.Coding)12 Reference (org.hl7.fhir.dstu3.model.Reference)8 IdType (org.hl7.fhir.dstu3.model.IdType)5 ArrayList (java.util.ArrayList)4 Extension (org.hl7.fhir.dstu3.model.Extension)4 Date (java.util.Date)3 Period (org.hl7.fhir.dstu3.model.Period)3 FHIRException (org.hl7.fhir.exceptions.FHIRException)3 Outcome (org.monarchinitiative.loinc2hpocore.codesystems.Outcome)3 SlotDetail (uk.gov.hscic.model.appointment.SlotDetail)3 UnprocessableEntityException (ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException)2 AllergyIntolerance (org.hl7.fhir.dstu3.model.AllergyIntolerance)2 ContactDetail (org.hl7.fhir.dstu3.model.ContactDetail)2 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)2 HumanName (org.hl7.fhir.dstu3.model.HumanName)2 Identifier (org.hl7.fhir.dstu3.model.Identifier)2 Location (org.hl7.fhir.dstu3.model.Location)2 Narrative (org.hl7.fhir.dstu3.model.Narrative)2 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)2