private static bool?IsAllowed(CodableValue substitution)
        {
            Func <CodedValue, bool> medicationSubstitutionPredicate =
                coded => coded.VocabularyName == HealthVaultVocabularies.MedicationSubstitution;

            var codedValue = substitution.FirstOrDefault(medicationSubstitutionPredicate);

            switch (codedValue?.Value)
            {
            case HealthVaultMedicationSubstitutionCodes.DispenseAsWrittenCode:
                return(false);

            case HealthVaultMedicationSubstitutionCodes.SubstitutionPermittedCode:
                return(true);

            case null:
            default:
                return(null);
            }
        }
Beispiel #2
0
        private static void SetAllergyIntoleranceCategory(this AllergyIntolerance allergyIntolerance, CodableValue allergenType, Extension allergyExtension)
        {
            List <AllergyIntoleranceCategory?> lstAllergyIntoleranceCategory = new List <AllergyIntoleranceCategory?>();
            string aValue = allergenType.FirstOrDefault().Value;
            AllergyIntoleranceCategory allergyIntoleranceCategory;

            if (aValue != null)
            {
                if (Enum.TryParse(aValue, true, out allergyIntoleranceCategory))
                {
                    lstAllergyIntoleranceCategory.Add(allergyIntoleranceCategory);
                }
                else
                {
                    allergyExtension.AddExtension(HealthVaultExtensions.AllergenType, new FhirString(aValue));
                }
            }

            if (lstAllergyIntoleranceCategory.Count > 0)
            {
                allergyIntolerance.Category = lstAllergyIntoleranceCategory;
            }
        }