Exemplo n.º 1
0
        /// <summary>
        /// Encodes the main concept.
        /// </summary>
        /// <param name="conceptDetail">The concept detail.</param>
        /// <param name="searchState">State of the search.</param>
        private static void EncodeMainConcept(ConceptDetail conceptDetail, SearchState searchState)
        {
            searchState.EncodedConcept = new EncodedConcept(SnomedConcepts.Situation);

            if (searchState.InputFieldResult.IsNegated)
            {
                searchState.EncodedConcept.DisplayName = TerminologyManager.NegationDisplayString + " " + searchState.InputFieldResult.Description;
                searchState.EncodedConcept.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.FindingContext, new EncodedConcept(SnomedConcepts.KnownAbsent)));
                searchState.EncodedConcept.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.AssociatedFinding, new EncodedConcept(conceptDetail)));
                searchState.UserState = UserState.EncodingAdditionalConcept;
            }
            else
            {
                searchState.EncodedConcept.EncodedSingleConcept = conceptDetail;
                searchState.EncodedConcept.DisplayName          = searchState.InputFieldResult.Description;
                searchState.UserState = UserState.EncodingAdditionalConcept;
            }

            if (searchState.AdditionalTextBoxResults != null && searchState.AdditionalTextBoxResults.Count > 0)
            {
                AdditionalTextBoxResult additionalTextBoxResult = searchState.AdditionalTextBoxResults[0];

                terminologyProviderClient.GetConceptDetailsAsync(additionalTextBoxResult.SelectedItem.SnomedConceptId, TerminologyManager.LocaleString, searchState);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Calls out to service provider to get the ConceptDetails needed for laterality, negation and refinable characteristics.
        /// </summary>
        public static void Initialize()
        {
            TerminologyProviderClient terminologyProviderClient = new TerminologyProviderClient();

            terminologyProviderClient.GetConceptDetailsCompleted += delegate(object sender, GetConceptDetailsCompletedEventArgs e)
            {
                if (e.Error == null && e.Result != null)
                {
                    int index = (int)e.UserState;

                    SnomedConcepts.postCoordinationConceptsList[index] = new PostCoordinationConcept(e.Result, true);

                    SnomedConcepts.CheckInitialized();
                }
                else
                {
                    if (SnomedConcepts.Initialized != null)
                    {
                        SnomedConcepts.Initialized(null, new BaseTerminologyEventArgs(false));
                    }
                }
            };

            for (int i = 0; i < SnomedConcepts.postCoordinationConceptsList.Count; i++)
            {
                ConceptDetail conceptDetail = SnomedConcepts.postCoordinationConceptsList[i].ConceptDetail;

                if (conceptDetail != null && !string.IsNullOrEmpty(conceptDetail.SnomedConceptId))
                {
                    terminologyProviderClient.GetConceptDetailsAsync(conceptDetail.SnomedConceptId, TerminologyManager.LocaleString, i);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Encodes the laterality concept detail as a situation with explicit context.
        /// </summary>
        /// <param name="conceptDetail">The concept detail.</param>
        /// <param name="searchState">State of the search.</param>
        /// <param name="lateralityConceptDetail">The laterality concept detail.</param>
        private static void EncodeLaterality(ConceptDetail conceptDetail, SearchState searchState, ConceptDetail lateralityConceptDetail)
        {
            AttributeValuePair lateralityAttributeValuePair = new AttributeValuePair(SnomedConcepts.FindingSite, new EncodedConcept(conceptDetail));

            lateralityAttributeValuePair.Value.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.Laterality, new EncodedConcept(lateralityConceptDetail)));

            if (searchState.InputFieldResult.IsNegated)
            {
                if (searchState.EncodedConcept.AttributeCollection.Count > 1)
                {
                    searchState.EncodedConcept.AttributeCollection[1].Value.AttributeCollection.Add(lateralityAttributeValuePair);
                }
            }
            else
            {
                searchState.EncodedConcept.AttributeCollection.Add(lateralityAttributeValuePair);
            }

            searchState.UserState = UserState.EncodingAdditionalConcept;

            searchState.AdditionalTextBoxResults.RemoveAt(0);

            if (searchState.AdditionalTextBoxResults != null && searchState.AdditionalTextBoxResults.Count > 0)
            {
                AdditionalTextBoxResult additionalTextBoxResult = searchState.AdditionalTextBoxResults[0];

                terminologyProviderClient.GetConceptDetailsAsync(additionalTextBoxResult.SelectedItem.SnomedConceptId, TerminologyManager.LocaleString, searchState);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles the GetConceptDetailsCompleted event from TerminologyManager.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Microsoft.Cui.SamplePages.TerminologyProvider.GetConceptDetailsCompletedEventArgs"/> instance containing the event data.</param>
        private void TerminologyManagerGetConceptDetailsCompleted(object sender, GetConceptDetailsCompletedEventArgs e)
        {
            this.conceptDetail = e.Result;

            if (this.SingleConceptMatching.InputBoxSelectedItem != null && ValidateInputText(this.SingleConceptMatching.AdditionalTextBoxText))
            {
                this.lastAdditionalTextBoxSearch = this.SingleConceptMatching.AdditionalTextBoxText;
                if (this.connected)
                {
                    this.StatusText.Text = SingleConceptMatchingPage.SearchInProgressText;
                    this.ShowProgressBar();
                    this.indexerCallCount++;
                    TerminologyManager.ParseAdditionalTextBox(this.SingleConceptMatching.AdditionalTextBoxText, this.SingleConceptMatching.InputBoxSelectedItem as InputFieldResult, this.conceptDetail);
                }
            }
        }
        /// <summary>
        /// Handles the GetConceptDetailsCompleted event from TerminologyManager.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Microsoft.Cui.SampleWinform.TerminologyProvider.GetConceptDetailsCompletedEventArgs"/> instance containing the event data.</param>
        private void TerminologyManagerGetConceptDetailsCompleted(object sender, GetConceptDetailsCompletedEventArgs e)
        {
            this.conceptDetail = e.Result;

            if (this.SingleConceptMatching.InputBoxSelectedItem != null && ValidateInputText(this.SingleConceptMatching.AdditionalTextBoxText))
            {
                this.lastAdditionalTextBoxSearch = this.SingleConceptMatching.AdditionalTextBoxText;
                if (this.connected)
                {
                    this.StatusText.Text = SingleConceptMatchingPage.SearchInProgressText;
                    this.ShowProgressBar();
                    this.indexerCallCount++;
                    TerminologyManager.ParseAdditionalTextBox(this.SingleConceptMatching.AdditionalTextBoxText, this.SingleConceptMatching.InputBoxSelectedItem as InputFieldResult, this.conceptDetail);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Encodes the main concept.
        /// </summary>
        /// <param name="conceptDetail">The concept detail.</param>
        /// <param name="searchState">State of the search.</param>
        private static void EncodeMainConcept(ConceptDetail conceptDetail, SearchState searchState)
        {
            searchState.EncodedConcept = new EncodedConcept(SnomedConcepts.Situation);

            if (searchState.InputFieldResult.IsNegated)
            {                
                searchState.EncodedConcept.DisplayName = TerminologyManager.NegationDisplayString + " " + searchState.InputFieldResult.Description;
                searchState.EncodedConcept.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.FindingContext, new EncodedConcept(SnomedConcepts.KnownAbsent)));
                searchState.EncodedConcept.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.AssociatedFinding, new EncodedConcept(conceptDetail)));                
                searchState.UserState = UserState.EncodingAdditionalConcept;
            }
            else
            {
                searchState.EncodedConcept.EncodedSingleConcept = conceptDetail;
                searchState.EncodedConcept.DisplayName = searchState.InputFieldResult.Description;
                searchState.UserState = UserState.EncodingAdditionalConcept;
            }

            if (searchState.AdditionalTextBoxResults != null && searchState.AdditionalTextBoxResults.Count > 0)
            {
                AdditionalTextBoxResult additionalTextBoxResult = searchState.AdditionalTextBoxResults[0];

                terminologyProviderClient.GetConceptDetailsAsync(additionalTextBoxResult.SelectedItem.SnomedConceptId, TerminologyManager.LocaleString, searchState);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Encodes the laterality concept detail as a situation with explicit context.
        /// </summary>
        /// <param name="conceptDetail">The concept detail.</param>
        /// <param name="searchState">State of the search.</param>
        /// <param name="lateralityConceptDetail">The laterality concept detail.</param>
        private static void EncodeLaterality(ConceptDetail conceptDetail, SearchState searchState, ConceptDetail lateralityConceptDetail)
        {        
            AttributeValuePair lateralityAttributeValuePair = new AttributeValuePair(SnomedConcepts.FindingSite, new EncodedConcept(conceptDetail));
            lateralityAttributeValuePair.Value.AttributeCollection.Add(new AttributeValuePair(SnomedConcepts.Laterality, new EncodedConcept(lateralityConceptDetail)));

            if (searchState.InputFieldResult.IsNegated)
            {
                if (searchState.EncodedConcept.AttributeCollection.Count > 1)
                {
                    searchState.EncodedConcept.AttributeCollection[1].Value.AttributeCollection.Add(lateralityAttributeValuePair);
                }
            }
            else
            {
                searchState.EncodedConcept.AttributeCollection.Add(lateralityAttributeValuePair);
            }

            searchState.UserState = UserState.EncodingAdditionalConcept;

            searchState.AdditionalTextBoxResults.RemoveAt(0);

            if (searchState.AdditionalTextBoxResults != null && searchState.AdditionalTextBoxResults.Count > 0)
            {
                AdditionalTextBoxResult additionalTextBoxResult = searchState.AdditionalTextBoxResults[0];

                terminologyProviderClient.GetConceptDetailsAsync(additionalTextBoxResult.SelectedItem.SnomedConceptId, TerminologyManager.LocaleString, searchState);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Parses the additional text box.
        /// </summary>
        /// <param name="text">The text to parse for qualifiers.</param>
        /// <param name="inputFieldResult">The input field result.</param>
        /// <param name="conceptDetail">The concept detail.</param>
        public static void ParseAdditionalTextBox(string text, InputFieldResult inputFieldResult, ConceptDetail conceptDetail)
        {           
#if SILVERLIGHT
            string normalisedSearchString = text.ToUpper(CultureInfo.InvariantCulture);
#else
            string normalisedSearchString = text.ToUpperInvariant();
#endif
            ObservableCollection<string> domains = new ObservableCollection<string>();

            domains.Add(TerminologyManager.QualifiersDomainString);

            SearchState searchState = new SearchState();
            searchState.SearchTextOriginal = text;
            searchState.ConceptDetail = conceptDetail;
            searchState.InputFieldResult = inputFieldResult;

            if (conceptDetail.RefinableCharacteristics.Count > 0)
            {
                TerminologyManager.terminologyProviderClient.IndexTextAsync(normalisedSearchString, domains, null, false, TerminologyManager.LocaleString, searchState);
            }
            else
            {
                TerminologyManager.RaiseAdditionalTextBoxCompleted(new ObservableCollection<AdditionalTextBoxResult>(), searchState);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeValuePair"/> class.
 /// </summary>
 /// <param name="attribute">The attribute.</param>
 /// <param name="value">The value.</param>
 public AttributeValuePair(ConceptDetail attribute, EncodedConcept value)
 {
     this.Attribute = attribute;
     this.Value     = value;
 }
Exemplo n.º 10
0
        /// <summary>
        /// Parses the additional text box.
        /// </summary>
        /// <param name="text">The text to parse for qualifiers.</param>
        /// <param name="inputFieldResult">The input field result.</param>
        /// <param name="conceptDetail">The concept detail.</param>
        public static void ParseAdditionalTextBox(string text, InputFieldResult inputFieldResult, ConceptDetail conceptDetail)
        {
#if SILVERLIGHT
            string normalisedSearchString = text.ToUpper(CultureInfo.InvariantCulture);
#else
            string normalisedSearchString = text.ToUpperInvariant();
#endif
            ObservableCollection <string> domains = new ObservableCollection <string>();

            domains.Add(TerminologyManager.QualifiersDomainString);

            SearchState searchState = new SearchState();
            searchState.SearchTextOriginal = text;
            searchState.ConceptDetail      = conceptDetail;
            searchState.InputFieldResult   = inputFieldResult;

            if (conceptDetail.RefinableCharacteristics.Count > 0)
            {
                TerminologyManager.terminologyProviderClient.IndexTextAsync(normalisedSearchString, domains, null, false, TerminologyManager.LocaleString, searchState);
            }
            else
            {
                TerminologyManager.RaiseAdditionalTextBoxCompleted(new ObservableCollection <AdditionalTextBoxResult>(), searchState);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostCoordinationConcept"/> class.
 /// </summary>
 /// <param name="conceptDetail">The concept detail.</param>
 /// <param name="isInitialized">If set to <c>true</c> [is initialized].</param>
 public PostCoordinationConcept(ConceptDetail conceptDetail, bool isInitialized)
 {
     this.ConceptDetail = conceptDetail;
     this.IsInitialized = isInitialized;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeValuePair"/> class.
 /// </summary>
 /// <param name="attribute">The attribute.</param>
 /// <param name="value">The value.</param>
 public AttributeValuePair(ConceptDetail attribute, EncodedConcept value)
 {
     this.Attribute = attribute;
     this.Value = value;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostCoordinationConcept"/> class.
 /// </summary>
 /// <param name="conceptDetail">The concept detail.</param>
 /// <param name="isInitialized">If set to <c>true</c> [is initialized].</param>
 public PostCoordinationConcept(ConceptDetail conceptDetail, bool isInitialized)
 {
     this.ConceptDetail = conceptDetail;
     this.IsInitialized = isInitialized;
 }