none
Health Vault Medications RRS feed

  • Question

  • Hello All,

    I have notiiced when adding Medications online the text box recognizes the field been entered and shows the suggestions. Is this exposed via services so I can utilize in Windows Phone 7 App? Can some one provide me with examples please??

     

    Vish


    Viswanath Ivatury
    Friday, July 1, 2011 4:06 PM

Answers

  • Yes, this is exposed and callable by applications. You will need to go to the application center, choose your application, and then on the "misc" tab there is a field named "service token". If there isn't one there, hit the "generate" button, and then save the settings. It may take a few minutes for the settings to propagate.

    I don't have a sample that is specific to windows phone, but I wrote one yesterday that runs on the desktop, and it should be easy to adapt using the WebTransport class that's part of the HealthVault WP7 library.

    Here's the code. You will need to replace the service token with the one you generate:

      class Program
      {
        const string serviceToken = "ae9e1c6d-9ad7-4b2c-a39a-78bad1b7a538";
        
        const string baseSearchUrl = "https://platform.healthvault-ppe.com/platform/hvclientservice.ashx";
    
    
        static void Main(string[] args)
        {
          List<XElement> items = SearchVocabulary("RxNorm Active Medicines", "RxNorm", 10, "al");
    
        }
        
        static List<XElement> SearchVocabulary(string vocabName, string vocabFamily, int maxResults, string searchString)
        {
          string url =  baseSearchUrl + 
                  "?service=searchVocab&searchMode=fulltext&output=XML&serviceToken=" + serviceToken +
                  "&vocabName=" + HttpUtility.UrlEncode(vocabName) +
                  "&vocabFamily=" + HttpUtility.UrlEncode(vocabFamily) +
                  "&maxResults=" + maxResults.ToString() +
                  "&culture=en-US" +
                  "&searchString=" + HttpUtility.UrlEncode(searchString);
    
          List<XElement> items = new List<XElement>();
    
          WebRequest request = WebRequest.Create(url);
    
          WebResponse response = request.GetResponse();
    
          Stream responseStream = response.GetResponseStream();
          using (StreamReader reader = new StreamReader(responseStream))
          {
            string responseString = reader.ReadToEnd();
    
            XElement responseElement = XElement.Parse(responseString);
    
            items.AddRange(responseElement.Descendants("code-item"));
          }
    
          return items;
        }
      }
    

     

     

     

    • Marked as answer by indian09 Tuesday, July 12, 2011 6:19 PM
    Friday, July 1, 2011 5:19 PM