001package ca.uhn.fhir.cql.common.evaluation;
002
003/*-
004 * #%L
005 * HAPI FHIR JPA Server - Clinical Quality Language
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.i18n.Msg;
024import java.util.HashMap;
025import java.util.Map;
026
027public enum MeasurePopulationType {
028    INITIALPOPULATION("initial-population", "Initial Population",
029            "The initial population refers to all patients or events to be evaluated by a quality measure involving patients who share a common set of specified characterstics. All patients or events counted (for example, as numerator, as denominator) are drawn from the initial population"),
030
031    NUMERATOR("numerator", "Numerator",
032            "\tThe upper portion of a fraction used to calculate a rate, proportion, or ratio. Also called the measure focus, it is the target process, condition, event, or outcome. Numerator criteria are the processes or outcomes expected for each patient, or event defined in the denominator. A numerator statement describes the clinical action that satisfies the conditions of the measure"),
033
034    NUMERATOREXCLUSION("numerator-exclusion", "Numerator Exclusion",
035            "Numerator exclusion criteria define patients or events to be removed from the numerator. Numerator exclusions are used in proportion and ratio measures to help narrow the numerator (for inverted measures)"),
036
037    DENOMINATOR("denominator", "Denominator",
038            "The lower portion of a fraction used to calculate a rate, proportion, or ratio. The denominator can be the same as the initial population, or a subset of the initial population to further constrain the population for the purpose of the measure"),
039
040    DENOMINATOREXCLUSION("denominator-exclusion", "Denominator Exclusion",
041            "Denominator exclusion criteria define patients or events that should be removed from the denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator. For example, patients with bilateral lower extremity amputations would be listed as a denominator exclusion for a measure requiring foot exams"),
042
043    DENOMINATOREXCEPTION("denominator-exception", "Denominator Exception",
044            "Denominator exceptions are conditions that should remove a patient or event from the denominator of a measure only if the numerator criteria are not met. Denominator exception allows for adjustment of the calculated score for those providers with higher risk populations. Denominator exception criteria are only used in proportion measures"),
045
046    MEASUREPOPULATION("measure-population", "Measure Population",
047            "Measure population criteria define the patients or events for which the individual observation for the measure should be taken. Measure populations are used for continuous variable measures rather than numerator and denominator criteria"),
048
049    MEASUREPOPULATIONEXCLUSION("measure-population-exclusion", "Measure Population Exclusion",
050            "Measure population criteria define the patients or events that should be removed from the measure population before determining the outcome of one or more continuous variables defined for the measure observation. Measure population exclusion criteria are used within continuous variable measures to help narrow the measure population"),
051
052    MEASUREOBSERVATION("measure-observation", "Measure Observation",
053            "Defines the individual observation to be performed for each patient or event in the measure population. Measure observations for each case in the population are aggregated to determine the overall measure score for the population");
054
055    private String code;
056    private String display;
057    private String definition;
058
059    MeasurePopulationType(String code, String display, String definition) {
060        this.code = code;
061        this.display = display;
062        this.definition = definition;
063    }
064
065    private static final Map<String, MeasurePopulationType> lookup = new HashMap<>();
066
067    static {
068        for (MeasurePopulationType mpt : MeasurePopulationType.values()) {
069            lookup.put(mpt.toCode(), mpt);
070        }
071    }
072
073    // This method can be used for reverse lookup purpose
074    public static MeasurePopulationType fromCode(String code) {
075        if (code != null && !code.isEmpty()) {
076            if (lookup.containsKey(code)) {
077                return lookup.get(code);
078            }
079            // } else if (Configuration.isAcceptInvalidEnums()) {
080            //     return null;
081            // } else {
082            //     // throw new FHIRException(Msg.code(1655) + "Unknown MeasureScoring code \'" + code + "\'");
083            // }
084        }
085
086        return null;
087    }
088
089    public String getSystem() {
090        return "http://hl7.org/fhir/measure-population";
091    }
092
093    public String toCode() {
094        return this.code;
095    }
096
097    public String getDisplay() {
098        return this.display;
099    }
100
101    public String getDefinition() {
102        return this.definition;
103    }
104}