// GET: api/CancerRegistryCoding //public IEnumerable<string> Get() //{ // return new string[] { "value1", "value2" }; //} //// GET: api/CancerRegistryCoding/5 //public string Get(int id) //{ // return "value"; //} // POST: api/CancerRegistryCoding //public void Post([FromBody]string value) //{ //} public IHttpActionResult Post(CodingInput input) { List <string> histologies = new List <string>(); string behavior = ""; string laterality = ""; string grade = ""; List <string> sites = new List <string>(); try { new CodingService.Models.CodingService().GetCodes(input.HistologyPhrases, input.HistologySubtypePhrases, input.SitePhrases, input.RelativeLocationPhrases, input.BehaviorPhrases, input.GradePhrases, input.GradeValuePhrases, input.LateralityPhrases, input.DiagnosisDate, ref histologies, ref behavior, ref sites, ref grade, ref laterality ); CodedValue codedValue = new CodedValue(); codedValue.HistologCodes = histologies; codedValue.SiteCodes = sites; codedValue.GradeCode = grade; codedValue.BehaviorCode = behavior; codedValue.LateralityCode = laterality; return(Content(HttpStatusCode.Created, codedValue, new JsonMediaTypeFormatter())); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, "Error: " + ex.ToString(), new JsonMediaTypeFormatter())); } }
public ValueSetEntry CreateValueSet(CodedValue codedValue, String version, params VocabularyDomain[] vocabularyDomain) { ValueSet valueSet = new ValueSet(); valueSet.Name = "testValueSetName" + uniqueNameSuffix; valueSet.Version = version; uniqueNameSuffix++; ValueSetEntry result = new ValueSetEntry(); result.CodedValue = codedValue; result.Sequence = 1; result.Active = ILOG.J2CsMapping.Util.BooleanUtil.TRUE; result.Common = ILOG.J2CsMapping.Util.BooleanUtil.TRUE; result.ValueSet = valueSet; /* foreach */ foreach (VocabularyDomain domain in vocabularyDomain) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(result.ValueSet.VocabularyDomains, domain); } Save(result); return(result); }
public void ConsumerConsumesClass(XElement documentXEl, CodedValue code) { DocumentMetadata doc = XDMetadataConsumer.ConsumeDocument(documentXEl); Assert.Equal(code.ToString(), doc.Class.ToString()); Assert.True(code.Equals(doc.Class)); }
public static CodedValue ToCodedValue(this Coding coding) { var uri = new Uri(coding.System); var returnValue = new CodedValue { Value = coding.Code, Version = coding.Version, }; var family = CodeToHealthVaultHelper.GetFamily(uri); if (!string.IsNullOrEmpty(family)) { returnValue.Family = family; } var vocabName = CodeToHealthVaultHelper.GetVocabularyName(uri); if (!string.IsNullOrEmpty(vocabName)) { returnValue.VocabularyName = vocabName; } return(returnValue); }
private void Initialize(CodedValue value) { if (value == null) Initialize("", ""); else Initialize(value.Scheme, value.Label); }
private void CreateCodedValue(VocabularyDomain vocabularyDomain, String oid, String code, String parentCode, IList <String> childCodes) { CodeSystem codeSystem_0 = this.factory.CreateCodeSystem(oid); CodedValue codeCodedValue = CreateCodedValue(vocabularyDomain, codeSystem_0, code); CodedValue parentCodeCodedValue = null; if (parentCode != null) { parentCodeCodedValue = CreateCodedValue(vocabularyDomain, codeSystem_0, parentCode); } IList <CodedValue> childCodesCodedValues = new List <CodedValue>(); if (childCodes != null) { /* foreach */ foreach (String childCode in childCodes) { CodedValue childCodedValue = CreateCodedValue(vocabularyDomain, codeSystem_0, childCode); ILOG.J2CsMapping.Collections.Generics.Collections.Add(childCodesCodedValues, childCodedValue); } } this.factory.CreateCodedValue(codeCodedValue, parentCodeCodedValue, childCodesCodedValues); }
private string ExpressionToString(UtilityTraceConditionalExpression expression) { if (expression is UtilityCategoryComparison categoryComparison) { return($"`{categoryComparison.Category.Name}` {categoryComparison.ComparisonOperator}"); } else if (expression is UtilityNetworkAttributeComparison attributeComparison) { // Check if attribute domain is a coded value domain. if (attributeComparison.NetworkAttribute.Domain is CodedValueDomain domain) { // Get the coded value using the the attribute comparison value and attribute data type. UtilityNetworkAttributeDataType dataType = attributeComparison.NetworkAttribute.DataType; object attributeValue = ConvertToDataType(attributeComparison.Value, attributeComparison.NetworkAttribute.DataType); CodedValue codedValue = domain.CodedValues.FirstOrDefault(value => ConvertToDataType(value.Code, dataType).Equals(attributeValue)); return($"`{attributeComparison.NetworkAttribute.Name}` {attributeComparison.ComparisonOperator} `{codedValue?.Name}`"); } else { return($"`{attributeComparison.NetworkAttribute.Name}` {attributeComparison.ComparisonOperator} `{attributeComparison.OtherNetworkAttribute?.Name ?? attributeComparison.Value}`"); } } else if (expression is UtilityTraceAndCondition andCondition) { return($"({ExpressionToString(andCondition.LeftExpression)}) AND\n ({ExpressionToString(andCondition.RightExpression)})"); } else if (expression is UtilityTraceOrCondition orCondition) { return($"({ExpressionToString(orCondition.LeftExpression)}) OR\n ({ExpressionToString(orCondition.RightExpression)})"); } else { return(null); } }
private CodedValue CreateCodedValue(String code) { CodedValue result = new CodedValue(); result.Code = code; result.CodeSystem = CreateCodeSystem(); return(result); }
private CodedValue CreateCodedValue(VocabularyDomain vocabularyDomain, CodeSystem codeSystem_0, String code) { CodedValue codedValue = this.factory.CreateCodedValue(codeSystem_0, code); this.factory.CreateValueSet(codedValue, vocabularyDomain); return(codedValue); }
public static Coding ToFhir(this CodedValue codedValue) { return(new Coding { Code = codedValue.Value, System = GetSystemUrl(codedValue), Version = codedValue.Version, }); }
private T CreateCode <T>(Type type, CodedValue value_ren, ILOG.J2CsMapping.Collections.Generics.ISet <Type> implementedTypes) where T : Code { IDictionary <String, String> displayTextMap = new Dictionary <String, String>(); displayTextMap.AddAll(value_ren.Descriptions); return(type.Cast <T>(this.codeFactory.Create(type, implementedTypes, value_ren.Code, value_ren.CodeSystem.Oid, value_ren.CodeSystem.Name, displayTextMap, 1, true, true))); }
private CodedValue CreateCodedValue(VocabularyDomain vocabularyDomain, String oid, String code, String version) { CodeSystem codeSystem_0 = this.factory.CreateCodeSystem(oid); CodedValue codedValue = this.factory.CreateCodedValue(codeSystem_0, code); this.factory.CreateValueSet(codedValue, version, vocabularyDomain); return(codedValue); }
private static string GetSystemUrl(CodedValue codedValue) { // If the coded value family contains a URL, it's not a healvault vocab and we should return it as is if (codedValue.Family.Contains("http")) { return(codedValue.Family); } return(HealthVaultVocabularies.GenerateSystemUrl(codedValue.VocabularyName, codedValue.Family)); }
internal static FhirMedication ToFhirInternal(HVMedication hvMedication, FhirMedication fhirMedication) { fhirMedication.Code = hvMedication.Name.ToFhir(); if (hvMedication.GenericName != null || hvMedication.Strength != null) { var medicationExtension = new Extension { Url = HealthVaultExtensions.Medication }; if (hvMedication.GenericName != null) { var genericName = hvMedication.GenericName?.ToFhir(); medicationExtension.AddExtension(HealthVaultExtensions.MedicationGenericName, genericName); } if (hvMedication.Strength != null) { var strengthExtension = new Extension { Url = HealthVaultExtensions.MedicationStrength }; strengthExtension.AddExtension(HealthVaultExtensions.MedicationStrengthDisplay, new FhirString(hvMedication.Strength.Display)); foreach (var structuredMeasurement in hvMedication.Strength.Structured) { var simpleQuantity = new SimpleQuantity() { Value = new decimal(structuredMeasurement.Value), Unit = structuredMeasurement.Units.Text }; if (structuredMeasurement.Units.Any()) { CodedValue measurementUnit = structuredMeasurement.Units.First(); simpleQuantity.Code = measurementUnit.Value; simpleQuantity.System = HealthVaultVocabularies.GenerateSystemUrl(measurementUnit.VocabularyName, measurementUnit.Family); } strengthExtension.AddExtension(HealthVaultExtensions.MedicationStrengthQuantity, simpleQuantity); } medicationExtension.Extension.Add(strengthExtension); } fhirMedication.Extension.Add(medicationExtension); } return(fhirMedication); }
private void Initialize(CodedValue value) { if (value == null) { Initialize("", ""); } else { Initialize(value.Scheme, value.Label); } }
private static string GetSystemUrl(CodedValue codedValue) { bool isNonHealthVaultVocabulary = codedValue.VocabularyName.Contains("http"); if (isNonHealthVaultVocabulary) { return(codedValue.VocabularyName); } return(HealthVaultVocabularies.GenerateSystemUrl(codedValue.VocabularyName, codedValue.Family)); }
private CodedValue CreateCodedValueWithDisplayText(String code) { CodedValue result = CreateCodedValue(code); IDictionary <String, String> map = new Dictionary <String, String>(); ILOG.J2CsMapping.Collections.Generics.Collections.Put(map, (System.String)("en"), (System.String)("english")); ILOG.J2CsMapping.Collections.Generics.Collections.Put(map, (System.String)("fr"), (System.String)("french")); result.Descriptions = map; return(result); }
private bool CodedValueFound(IList <CodedValue> codedValues, String code) { for (IIterator <CodedValue> i = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <Ca.Infoway.Messagebuilder.Terminology.Codeset.Domain.CodedValue>(codedValues.GetEnumerator()); i.HasNext();) { CodedValue value_ren = i.Next(); if (value_ren.Code.Equals(code)) { return(true); } } return(false); }
public CodedValue CreateCodedValue(CodeSystem codeSystem, String code) { CodedValue result = new CodedValue(); result.Code = code; result.CodeSystem = codeSystem; result.CreateUserId = "HWNG"; result.LastUpdateDatetime = new PlatformDate(); result.CreateDatetime = new PlatformDate(); Save(result); return(result); }
public void TestFindCodedValueWithNoChildrenNoParent() { CreateCodedValue(CODE, SUB_VOCABULARY_DOMAIN, PARENT_VOCABULARY_DOMAIN); x_DrugUnitsOfMeasure code = (x_DrugUnitsOfMeasure)Ca.Infoway.Messagebuilder.Terminology.CodeResolverRegistry .Lookup(SUB_VOCABULARY_DOMAIN, CODE, OID); CodedValue codedValue = this.dao.FindCodedValue(code); NUnit.Framework.Assert.IsNotNull(codedValue); NUnit.Framework.Assert.IsTrue((codedValue.Children.Count == 0)); NUnit.Framework.Assert.IsTrue((codedValue.Parents.Count == 0)); }
public static CodedValue ToCodedValue(this Coding coding) { var familyVocab = HealthVaultVocabularies.ExtractFamilyAndVocabularyFromSystemUrl(coding.System); var returnValue = new CodedValue { Value = coding.Code, VocabularyName = familyVocab.vocabulary, Family = familyVocab.family, Version = coding.Version, }; return(returnValue); }
/// <summary> /// {@inheritDoc} /// </summary> /// /* @SuppressWarnings("unchecked")*/ public virtual CodedValue FindCodedValue(Code code) { // TM - *not* modifying this method to use version, as it does not reference the valueset table, even though it does deal with codes CodedValue result = null; if (code != null) { result = (CodedValue)HibernateTemplate.Execute( new HibernateCodeSetDao.Anonymous_C3(code)); } return(result); }
public void TestFindCodedValueWithChildrenAndParent() { VocabularyDomain vocabularyDomain = this.factory .CreateVocabularyDomain(typeof(Confidentiality)); CreateCodedValue(vocabularyDomain, OID, CODE, "parent", ILOG.J2CsMapping.Collections.Generics.Arrays.AsList("child1", "child2", "child3")); Confidentiality code = (Confidentiality)Ca.Infoway.Messagebuilder.Terminology.CodeResolverRegistry.Lookup <Confidentiality>( typeof(Confidentiality), CODE, OID); CodedValue codedValue = this.dao.FindCodedValue(code); NUnit.Framework.Assert.IsNotNull(codedValue); NUnit.Framework.Assert.IsFalse((codedValue.Children.Count == 0)); NUnit.Framework.Assert.AreEqual(3, codedValue.Children.Count); NUnit.Framework.Assert.IsFalse((codedValue.Parents.Count == 0)); }
public ValueSetEntry CreateValueSet(CodedValue codedValue, params VocabularyDomain[] vocabularyDomain) { ValueSetEntry result = new ValueSetEntry(); result.CodedValue = codedValue; result.Sequence = 1; result.Active = ILOG.J2CsMapping.Util.BooleanUtil.TRUE; result.Common = ILOG.J2CsMapping.Util.BooleanUtil.TRUE; result.ValueSet = new ValueSet(); /* foreach */ foreach (VocabularyDomain domain in vocabularyDomain) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(result.ValueSet.VocabularyDomains, domain); } Save(result); return(result); }
// GET: api/CancerRegistryCoding //public IEnumerable<string> Get() //{ // return new string[] { "value1", "value2" }; //} //// GET: api/CancerRegistryCoding/5 //public string Get(int id) //{ // return "value"; //} // POST: api/CancerRegistryCoding //public void Post([FromBody]string value) //{ //} public IHttpActionResult Post(CodingInput input) { string histologybehavior = ""; string laterality = ""; string grade = ""; string site = ""; new CodingService.Models.CodingService().GetCodes(input.HistologyPhrases, input.HistologySubtypePhrases, input.SitePhrases, input.RelativeLocationPhrases, input.BehaviorPhrases, input.GradePhrases, input.GradeValuePhrases, input.LateralityPhrases, input.DiagnosisDate, ref histologybehavior, ref site, ref grade, ref laterality ); CodedValue codedValue = new CodedValue(); codedValue.HistologyBehaviorCode = histologybehavior; codedValue.SiteCode = site; codedValue.GradeCode = grade; codedValue.LateralityCode = laterality; return(Content(HttpStatusCode.Created, codedValue, new JsonMediaTypeFormatter())); }
public CodedValue CreateCodedValue(CodedValue code, CodedValue parent, IList <CodedValue> children) { if (code == null) { return(code); } if (parent != null) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(code.Parents, parent); ILOG.J2CsMapping.Collections.Generics.Collections.Add(parent.Children, code); } if (children != null) { /* foreach */ foreach (CodedValue child in children) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(child.Parents, code); ILOG.J2CsMapping.Collections.Generics.Collections.Add(code.Children, child); } } Save(code); if (parent != null) { Save(parent); } if (children != null) { /* foreach */ foreach (CodedValue child_0 in children) { Save(child_0); } } return(code); }
public static SimpleQuantity GetSimpleQuantity(GeneralMeasurement measurement) { if (measurement?.Structured.Any() == true) { StructuredMeasurement structuredMeasurement = measurement.Structured.First(); var simpleQuantity = new SimpleQuantity() { Value = new decimal(structuredMeasurement.Value), Unit = structuredMeasurement.Units.Text }; if (structuredMeasurement.Units.Any()) { CodedValue measurementUnit = structuredMeasurement.Units.First(); simpleQuantity.Code = measurementUnit.Value; simpleQuantity.System = HealthVaultVocabularies.GenerateSystemUrl(measurementUnit.VocabularyName, measurementUnit.Family); } return(simpleQuantity); } return(null); }
private void CreateCodedValue(String code, params Type[] vocabularyDomainType) { if (this.codeSystem == null) { this.codeSystem = this.factory.CreateCodeSystem(OID); } CodedValue codedValue = this.factory.CreateCodedValue(this.codeSystem, code); IList <VocabularyDomain> domains_0 = new List <VocabularyDomain>(); /* foreach */ foreach (Type domain in vocabularyDomainType) { VocabularyDomain vocabularyDomain = ((Ca.Infoway.Messagebuilder.Terminology.Codeset.Domain.VocabularyDomain)ILOG.J2CsMapping.Collections.Generics.Collections.Get(this.domains, domain)); if (vocabularyDomain == null) { vocabularyDomain = this.factory.CreateVocabularyDomain(domain); ILOG.J2CsMapping.Collections.Generics.Collections.Put(this.domains, (System.Type)(domain), (Ca.Infoway.Messagebuilder.Terminology.Codeset.Domain.VocabularyDomain)(vocabularyDomain)); } ILOG.J2CsMapping.Collections.Generics.Collections.Add(domains_0, vocabularyDomain); } this.factory.CreateValueSet(codedValue, ILOG.J2CsMapping.Collections.Generics.Collections.ToArray(domains_0, new VocabularyDomain[domains_0.Count])); }
/// <summary> /// Initializes an instance with the supplied classification scheme, node representation, classified object and /// a name element for the label and a slot for the code. /// </summary> /// <param name="scheme">The classification scheme UUID</param> /// <param name="nodeRepresentation">The node representation</param> /// <param name="classifiedObject">The document that is being classified</param> /// <param name="value">The coded value</param> public CodedValueClassification(string scheme, string nodeRepresentation, string classifiedObject, CodedValue value) : base(scheme, nodeRepresentation, classifiedObject) { Initialize(value); }
/// <summary> /// Initializes an instance with the supplied classification scheme, node representation, classified object and /// a name element for the label and a slot for the code. /// </summary> /// <param name="attr">The XD metadata attribute type</param> /// <param name="classifiedObject">The document that is being classified</param> /// <param name="value">The <see cref="CodedValue"/> for this classification</param> public CodedValueClassification(XDAttribute attr, string classifiedObject, CodedValue value) : base(attr, value.Code, classifiedObject) { Initialize(value); }
public static FieldDomain GetDomain(Domain fs_domain) { FieldDomain result; try { ObservableDictionary <string, FieldDomain> domains = AfaDocData.ActiveDocData.DocDataset.Domains; string key = DocUtil.FixSymbolName(fs_domain.DomainName); FieldDomain fieldDomain = null; if (domains.TryGetValue(key, out fieldDomain) && FieldDomain.AreEquivalent(fieldDomain, fs_domain)) { result = fieldDomain; } else { string domainType = ""; if (fs_domain is CodedValueDomain) { domainType = "CodedValueDomain"; } else if (fs_domain is RangeDomain) { domainType = "RangeDomain"; } CadField.CadFieldType cadFieldType = FieldDomain.GetCadFieldType(fs_domain.FieldType); fieldDomain = new FieldDomain(fs_domain.DomainName, cadFieldType, domainType); if (fs_domain is CodedValueDomain) { CodedValueDomain codedValueDomain = (CodedValueDomain)fs_domain; if (codedValueDomain.CodedValues.Length <= 0) { goto IL_129; } CodedValue[] array = codedValueDomain.CodedValues.ToArray <CodedValue>(); try { CodedValue[] array2 = array; for (int i = 0; i < array2.Length; i++) { CodedValue codedValue = array2[i]; fieldDomain.CodedValues.Add(DocUtil.FixSymbolName(codedValue.Name), new MSCCodedValue(codedValue.Name, cadFieldType, codedValue.Code)); } goto IL_129; } catch (SystemException ex) { string arg_FC_0 = ex.Message; goto IL_129; } } if (fs_domain is RangeDomain) { RangeDomain rangeDomain = (RangeDomain)fs_domain; fieldDomain.MinValue = rangeDomain.MinValue; fieldDomain.MaxValue = rangeDomain.MaxValue; } IL_129: AfaDocData.ActiveDocData.DocDataset.Domains.Add(fieldDomain.Name, fieldDomain); result = fieldDomain; } } catch { result = null; } return(result); }
public void ConsumerConsumesPackageTypeCode(XElement xl, CodedValue expected) { DocumentPackage package = XDMetadataConsumer.Consume(xl); Assert.Equal(package.ContentTypeCode, expected); }
public void ConsumerConsumesPracticeSetting(XElement documentXEl, CodedValue expected) { DocumentMetadata doc = XDMetadataConsumer.ConsumeDocument(documentXEl); Assert.Equal(expected, doc.PracticeSetting); }
public void ConsumerConsumesFormat(XElement documentXEl, CodedValue expected) { DocumentMetadata doc = XDMetadataConsumer.ConsumeDocument(documentXEl); Assert.Equal(expected, doc.FormatCode); }
public void ConsumerConsumesConfidentialty(XElement documentXEl, CodedValue expected) { DocumentMetadata doc = XDMetadataConsumer.ConsumeDocument(documentXEl); Assert.Equal(expected, doc.Confidentiality); }