All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.linuxforhealth.hl7.expression.specification.SpecificationUtil Maven / Gradle / Ivy

Go to download

FHIR converter is a Java based library that enables converting Hl7v2 messages to FHIR resources

There is a newer version: 1.0.19
Show newest version
package io.github.linuxforhealth.hl7.expression.specification;

import java.util.List;
import java.util.Map;
import io.github.linuxforhealth.api.EvaluationResult;
import io.github.linuxforhealth.api.InputDataExtractor;
import io.github.linuxforhealth.api.Specification;
import io.github.linuxforhealth.core.expression.EmptyEvaluationResult;

public class SpecificationUtil {

  private SpecificationUtil() {}
  public static EvaluationResult extractValueForSpec(List hl7specs, InputDataExtractor source,
      Map contextValues) {

    EvaluationResult fetchedValue = null;
    for (Specification spec : hl7specs) {

      fetchedValue = spec.extractValueForSpec(source, contextValues);
        // break the loop and return
        if (fetchedValue != null && !fetchedValue.isEmpty()) {
        return fetchedValue;
        }

    }
    return new EmptyEvaluationResult();


  }




  public static EvaluationResult extractMultipleValuesForSpec(List hl7specs,
      InputDataExtractor source, Map contextValues) {
    EvaluationResult fetchedValue = null;
    for (Specification spec : hl7specs) {

      fetchedValue = spec.extractMultipleValuesForSpec(source, contextValues);
        // break the loop and return
        if (fetchedValue != null && !fetchedValue.isEmpty()) {
          return fetchedValue;
        }

    }
    return new EmptyEvaluationResult();

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy