none
SDK throws exception while parsing Medication RRS feed

  • Question

  • I am getting the following error in production detailed below.

    While parsing the xml of an medication instance (new version) created by some other application, the SDK throws an error.  I am attaching the XML of the medication instance and the stack trace below.  I believe the exception is thrown since there is an empty strength node in the medication instance's xml.  Are there any quick fixes to the issue since the application in question is already in production.  I think this is because SDK expects certain nodes to be filled but these are not validated while the instance was created using PutThings method directly or using another version of SDK.


    ...
    <strength>
            <display />
    </strength>
    ....

    [ArgumentException: value
    Parameter name: A general measurement must always have a display. ]
       Microsoft.Health.ItemTypes.GeneralMeasurement.set_Display(String value) in c:\src\hsmain\private\prod\src\sdk\ItemTypes\GeneralMeasurement.cs:174
       Microsoft.Health.ItemTypes.GeneralMeasurement.ParseXml(XPathNavigator navigator) in c:\src\hsmain\private\prod\src\sdk\ItemTypes\GeneralMeasurement.cs:78
       Microsoft.Health.XPathHelper.GetOptNavValue(XPathNavigator nav, String elementName) in c:\src\hsmain\private\prod\src\sdk\core\XPathHelper.cs:206
       Microsoft.Health.ItemTypes.Medication.ParseXml(IXPathNavigable typeSpecificXml) in c:\src\hsmain\private\prod\src\sdk\ItemTypes\Medication.cs:102
       Microsoft.Health.HealthRecordItem.AddXmlSectionValues(XPathNavigator thingNavigator) in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordItem.cs:1391
    
    [HealthRecordItemDeserializationException: The type specific item data could not be parsed.]
       Microsoft.Health.HealthRecordItem.AddXmlSectionValues(XPathNavigator thingNavigator) in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordItem.cs:1395
       Microsoft.Health.HealthRecordItem.ParseXml(XPathNavigator thingNavigator, XmlReader thingReader) in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordItem.cs:1245
       Microsoft.Health.ItemTypeManager.DeserializeItem(XmlReader thingReader) in c:\src\hsmain\private\prod\src\sdk\core\ItemTypeManager.cs:704
       Microsoft.Health.HealthRecordItemCollection.CreateResultGroupFromResponse(HealthRecordAccessor record, XmlReader groupReader, IList`1 filters) in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordItemCollection.cs:121
       Microsoft.Health.HealthRecordSearcher.Execute() in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordSearcher.cs:423
       Microsoft.Health.HealthRecordSearcher.GetMatchingItems() in c:\src\hsmain\private\prod\src\sdk\core\HealthRecordSearcher.cs:111
    




    PS: I have removed some text and replaced it with the string "REMOVED"

    <thing>
      <thing-id version-stamp="3603e362-4ea2-4078-bbb2-b0e0f2ce4f7b">34b9377b-689d-423c-b1bb-8efe08afca09</thing-id>
      <type-id name="Medication">30cafccc-047d-4288-94ef-643571f7919d</type-id>
      <thing-state>Active</thing-state>
      <eff-date>2009-07-21T23:40:02.215</eff-date>
      <data-xml>
        <medication>
          <name>
            <text>REMOVED</text>
          </name>
          <generic-name>
            <text>REMOVED</text>
          </generic-name>
          <strength>
            <display />
          </strength>
          <frequency>
            <display>REMOVED</display>
          </frequency>
          <date-started>
            <structured>
              <date>
                <y>2008</y>
                <m>9</m>
                <d>11</d>
              </date>
            </structured>
          </date-started>
          <prescription>
            <prescribed-by>
              <name>
                <full>REMOVED</full>
              </name>
            </prescribed-by>
            <date-prescribed>
              <structured>
                <date>
                  <y>2008</y>
                  <m>9</m>
                  <d>11</d>
                </date>
              </structured>
            </date-prescribed>
            <amount-prescribed>
              <display>480</display>
            </amount-prescribed>
            <refills>1</refills>
            <prescription-expiration>
              <y>2009</y>
              <m>9</m>
              <d>11</d>
            </prescription-expiration>
            <instructions>
              <text>REMOVED</text>
            </instructions>
          </prescription>
        </medication>
        <common>
          <related-thing>
            <client-thing-id>REMOVED</client-thing-id>
          </related-thing>
          <client-thing-id>REMOVED</client-thing-id>
        </common>
      </data-xml>
    </thing>
    





     


    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    Friday, July 24, 2009 9:21 AM

Answers

All replies