Search in sources :

Example 26 with Coding

use of org.hl7.fhir.r4.model.Coding 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 27 with Coding

use of org.hl7.fhir.r4.model.Coding 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

Coding (org.hl7.fhir.dstu3.model.Coding)16 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)13 IdType (org.hl7.fhir.dstu3.model.IdType)5 Reference (org.hl7.fhir.dstu3.model.Reference)5 Extension (org.hl7.fhir.dstu3.model.Extension)4 Outcome (org.monarchinitiative.loinc2hpocore.codesystems.Outcome)4 Identifier (org.hl7.fhir.dstu3.model.Identifier)3 Location (org.hl7.fhir.dstu3.model.Location)3 Period (org.hl7.fhir.dstu3.model.Period)3 FHIRException (org.hl7.fhir.exceptions.FHIRException)3 Search (ca.uhn.fhir.rest.annotation.Search)2 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Collectors (java.util.stream.Collectors)2 HumanName (org.hl7.fhir.dstu3.model.HumanName)2 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)2 Practitioner (org.hl7.fhir.dstu3.model.Practitioner)2 Schedule (org.hl7.fhir.dstu3.model.Schedule)2 DateTimeDt (ca.uhn.fhir.model.primitive.DateTimeDt)1