locked
What data type use for storing Report text RRS feed

  • Question

  • I posted same question in DataType forum, but seems much less people visit that forum. Hopefully it can be answered here.

    Our institution has interface to handle HL7 and store the report text in a relational database. So if we want to upload the exam report (which can be a string read from sql database) onto HealthVault in plain text format, what ItemTypes should I use?

    Someone suggested to use File, I don't know which attribute can be used to assign the string vaule and if there's any example.

    Thanks, -W.Z

    Thursday, July 15, 2010 7:22 PM

Answers

  • Hello,

    I couldn't clearly understand kind of the reports are you mentioning here. We have some data types that are related to this I feel for example Discharge Summary, Health Assessment, Lab Test Results, Question Answer, Radiology Lab Result. Can you please taka a look at our Thing Type Reference and confirm whether any of these matches your requirement? Else please explain the scenario that you are trying to work on.

    Also if you feel one of these data types can be used but doesn't exactly match your requirement then you can try extending the data type for your use.

    If none of the data types match it you can create your own data type and use it with the HealthVault platform. For big amount of data you can also use the blob implementation as suggested in this white paper.

    Thanks and Regards,

    Aneesh D. 

    • Proposed as answer by Aneesh D Tuesday, July 20, 2010 9:56 PM
    • Unproposed as answer by W.Z. _ Tuesday, July 27, 2010 4:37 PM
    • Marked as answer by W.Z. _ Tuesday, July 27, 2010 4:40 PM
    Thursday, July 15, 2010 9:11 PM
  • Since you can see it in xray, we know that it's getting successfully inserted into the record, and it looks like the code that you are using is correct.

    The most likely thing is that your fetching application doesn't have priviledge to see the Radiology lab results data type, so I'd check that in the Application Configuration Center. You can verify that this is the case in your code with the following:

    List<Guid> items = new List<Guid>();
    items.Add(RadiologyLabResults.TypeId);
    Collection<HealthRecordItemTypePermission> permissions =
            PersonInfo.SelectedRecord.QueryPermissions(items);

    and then look in permissions to see what access your program has.

    If that's not it, my best guess is that you aren't looking at the same record in xray as you are in your fetching program.  

    • Marked as answer by W.Z. _ Tuesday, July 27, 2010 4:37 PM
    Monday, July 26, 2010 9:03 PM

All replies

  • Hello,

    I couldn't clearly understand kind of the reports are you mentioning here. We have some data types that are related to this I feel for example Discharge Summary, Health Assessment, Lab Test Results, Question Answer, Radiology Lab Result. Can you please taka a look at our Thing Type Reference and confirm whether any of these matches your requirement? Else please explain the scenario that you are trying to work on.

    Also if you feel one of these data types can be used but doesn't exactly match your requirement then you can try extending the data type for your use.

    If none of the data types match it you can create your own data type and use it with the HealthVault platform. For big amount of data you can also use the blob implementation as suggested in this white paper.

    Thanks and Regards,

    Aneesh D. 

    • Proposed as answer by Aneesh D Tuesday, July 20, 2010 9:56 PM
    • Unproposed as answer by W.Z. _ Tuesday, July 27, 2010 4:37 PM
    • Marked as answer by W.Z. _ Tuesday, July 27, 2010 4:40 PM
    Thursday, July 15, 2010 9:11 PM
  • W.Z.

    We had a discussion among those of us who own the data types, and we think the best fit right now would be to use the Health Assessment data type.

    We would like to understand you whole scenario a bit better. Can you tell us more about your scenario? Where is your data coming from, why are you putting it into HealthVault, etc.?

    • Proposed as answer by Aneesh D Tuesday, July 20, 2010 9:56 PM
    Friday, July 16, 2010 4:02 PM
  • Our scenario is that the finalized radiology report content are storing in SQL server as TEXT datatype, and we would like to drop-off the report content to HealthVault  together with exam images (will need a way to associate the report with exam) and plan to create a web application so the patient can display and share the report/images content  with his/her physicians later.

    I have tried Assessment as following code:
    List<HealthRecordItem> packageContent = new List<HealthRecordItem>();
    Assessment report = new Assessment(new CodableValue("studyUID"),new CodableValue("This is a test report.\n No value"));
    packageContent.Add(report);

    but got error "Argument '1': cannot convert from 'Microsoft.Health.ItemTypes.Assessment' to 'Microsoft.Health.HealthRecordItem' "

    Monday, July 19, 2010 4:19 PM
  • Assessment is a HealthRecordItem data and not a HealthRecordItem. To upload the health assesment values please use the data type HealthAssessment. The result property of this data type stores the Assesment objects. You can pass the collection of assesments into the following constructor,

    public HealthAssessment(HealthServiceDateTime when, String name, CodableValue category, IList<Assessment> result)

    If you are looking for a way to associate two HealthVault data types you can always use the related items as suggested in Eric's blog.

    Are these images DICOM images? Our Medical Image Study data type supports DICOM image formats.

    Thanks and Regards,

    Aneesh D.

    • Proposed as answer by Aneesh D Tuesday, July 20, 2010 9:56 PM
    Monday, July 19, 2010 9:08 PM
  • Right, I did use MedicalImageStudy for DICOM images, and that works perfect.

    I tried HealthAssessment for our Radiology report and added the relationship to the MedicalImageStudy in the same package, the code snippet is as following.
    However I got exception "A health record item key must be specified.\r\nParameter name: itemKey" at the last line of code, and found reportAssessment.Key is null.
    Am I missing anything here? Thanks for your help, -W.Z

     

    HealthAssessment reportAssessment = new HealthAssessment();
    reportAssessment.When = acquisitionDateTime;
    reportAssessment.Name = patientName;
    reportAssessment.Category =
    new CodableValue("Report Assessment");
    Assessment report = new Assessment();
    report.Name =
    new CodableValue("Rediology Report");
    report.Value =
    new CodableValue(reportContent);
    reportAssessment.Result.Add(report);
    medicalImageStudy.CommonData.RelatedItems.Add(
    new HealthRecordItemRelationship(reportAssessment.Key));

    Tuesday, July 20, 2010 8:16 PM
  • For each HealthRecordItem to have the key value first you have to add the item to the HealthVault record. This time the key value will be generated for the item. Then you can use that key value to add as the related item. Please try the below code.

    reportAssessment.Result.Add(report);
    PersonInfo.SelectedRecord.NewItem(reportAssessment);
    medicalImageStudy.CommonData.RelatedItems.Add(new HealthRecordItemRelationship(reportAssessment.Key));

    Thanks and Regards,
    Aneesh D.

    Tuesday, July 20, 2010 9:55 PM
  • But this is a DOPU application, it does not association with any HealthVault record yet.

    Thanks, -W.Z

    Wednesday, July 21, 2010 3:48 PM
  • Hello,

    I contacted our technical team for this. Suggestion from the team is that please use the ClientId (present in CommonData) for adding the related item instead of the HealthRecordItem's key.

    Thanks and Regards,

    Aneesh D.

    Wednesday, July 21, 2010 10:21 PM
  • I changed to use this line of code:
    medicalImageStudy.CommonData.RelatedItems.Add(new HealthRecordItemRelationship(reportAssessment.CommonData.ClientId));

    then got error "A non null and non empty string must be specified for the client id." So I assigned StudyInstanceUID as the value to reportAssessment.CommonData.ClientId.

    But I don't know how to retrieve the relatedItem, originally I use this line of code:
    HealthRecordItem relatedItem = this.PersonInfo.SelectedRecord.GetItem(relationship.ItemKey.Id,HealthRecordItemSections.Core | HealthRecordItemSections.Xml);

    Obviously the ItemKey is null so an exception was raised. Can you please send me some sample of code? Thanks, -W.Z

    Thursday, July 22, 2010 4:28 PM
  • Once you get the HealthRecordItemRelationship objects you will have the Client ID values in it. For fetching these values you can use the HealthRecordFilter's ClientItemIds property. Add the Client ID you want to retrieve to the filter object. Then do a search on the record using this filter object. Please refer to the PB9 release notes.

    HealthRecordSearcher searcher = new HealthRecordSearcher(PersonInfo.SelectedRecord);
    HealthRecordFilter filter = new HealthRecordFilter();
    filter.ClientItemIds.Add(...); // Add the ids here
    filter.View.Sections = HealthRecordItemSections.All;
    searcher.Filters.Add(filter);

    ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems();

     

     

     

    Thanks and Regards,

    Aneesh D

    Thursday, July 22, 2010 6:25 PM
  • Thanks Aneesh. I have tried the code you send, but the results from searcher.GetMatchingItems returns 0 count.

    I was thinking another option, assign studyInstanceId to HealthAssessment.name, then search by the name using filter.XPath ="/thing/data-xml/health-assessment/name[.=\"" + studyInstanceUID + "\"]"

    However the search result has 0 count as well. Not sure where I'm doing wrong.

    W.Z.

    Friday, July 23, 2010 7:37 PM
  • I could retrieve the items using the below code,

        HealthRecordSearcher

     

     

    searcher = new HealthRecordSearcher(PersonInfo.SelectedRecord);

     

     

        HealthRecordFilter filter = new HealthRecordFilter();

        filter.ClientItemIds.Add(clientID.ToString());

     

    // Add the ids here

        filter.View.Sections =

     

    HealthRecordItemSections.All;

        searcher.Filters.Add(filter);

     

     

        ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems()

     

     

     

    At this point I am not sure why you are not getting the items back. Did you add all the studyInstanceUIDs to the filter? Are you not able to retrieve any of the items or just some of them?
    Friday, July 23, 2010 9:04 PM
  • You might also want to use X-ray to look at the data to make sure it's what you expect it to be. You can also use it to create xpaths if you need them.
    Friday, July 23, 2010 9:57 PM
  • I did get one count from
    ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems();

    But look into the first item from results, it has 0 count.
    HealthRecordItemCollection relatedItem = searcher.GetMatchingItems()[0];

     

     

    I see the HealthAssessment items were added under my HealthVault account, I can retrieve the medical image study using filter.XPath and did see the relationship.ClientId has the correct value I assigned, but unable to retrieve using this ClientId.

     

    Friday, July 23, 2010 10:05 PM
  • Hello,

    Have you verified whether the HealthAssesment object has the ClientID value assigned to its CommonData.ClientId. Below is a sample code that I used for the scenario. Please note that I did it using an Online connection and not PatientConnect.

            Height height = new Height(0.18);
            Guid clientID = Guid.NewGuid();
            height.CommonData.ClientId = clientID.ToString();
            PersonInfo.SelectedRecord.NewItem(height);

            Weight weight = new Weight(new HealthServiceDateTime(DateTime.Now), new WeightValue(68));
            weight.CommonData.RelatedItems.Add(new HealthRecordItemRelationship(clientID.ToString()));
            PersonInfo.SelectedRecord.NewItem(weight);

            HealthRecordItemCollection weightCollection = PersonInfo.SelectedRecord.GetItemsByType(Weight.TypeId);

            foreach (Weight item in weightCollection)
            {
                if (item.CommonData.RelatedItems.Count > 0)
                {
                    foreach (HealthRecordItemRelationship relation in item.CommonData.RelatedItems)
                    {
                        if (!String.IsNullOrEmpty(relation.ClientId) && (relation.ClientId != Guid.Empty.ToString()))
                        {
                            HealthRecordSearcher searcher = new HealthRecordSearcher(PersonInfo.SelectedRecord);
                            HealthRecordFilter filter = new HealthRecordFilter();
                            filter.ClientItemIds.Add(relation.ClientId);
                            filter.View.Sections = HealthRecordItemSections.All;
                            searcher.Filters.Add(filter);

                            ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems();
                            HealthRecordItemCollection collection = searcher.GetMatchingItems()[0];

                            string resultText = "Results count : " + collection.Count;
                        }
                    }
                }
            }

    Friday, July 23, 2010 10:57 PM
  • W.Z.,

    I missed the part about you storing radiology results. The radiology lab results data type is designed to address your scenario.

    Monday, July 26, 2010 4:26 PM
  • Hi Aneesh, my drop-off is an offline application, and the retrieve is an online connection. Yes I have verified the HealthAssessment does have the ClientID value assigned to its CommonData.ClientId. I did also add your code into my application and add the Height object into the drop-off package. On retrieval, the clientID has the correct value, but still "searcher.GetMatchingItems()[0]" returns 0 count.

    Monday, July 26, 2010 6:38 PM
  • Thanks Eric. I was able to drop off the radiology report onto HealthVault using these lines of code:
                RadiologyLabResults report = new RadiologyLabResults();
                report.When = acquisitionDateTime;
                //report.CommonData.ClientId = studyInstanceUID;
                report.Title = studyInstanceUID;
                report.ResultText = reportContent.ToString(); 

    However I have trouble to retrieve the report, below are the code I used to do the retrieval, it returns 0 count on searcher.GetMatchingItems()[0] when search by XPath or all sections.

     

            HealthRecordSearcher searcher = record.CreateSearcher();

            HealthRecordFilter filter = new HealthRecordFilter(RadiologyLabResults.TypeId);

            //filter.View.Sections =

            //    HealthRecordItemSections.Xml |

            //    HealthRecordItemSections.BlobPayload |

            //    HealthRecordItemSections.Signature;       

            //if (!String.IsNullOrEmpty(studyInstanceUID))

            //{

            //    filter.XPath = "/thing/data-xml/radiology-lab-results/title[.=\"" + studyInstanceUID + "\"]";

            //} 

            //searcher.Filters.Add(filter);

            filter.View.Sections = HealthRecordItemSections.All;

            searcher.Filters.Add(filter); 

            ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems();

            HealthRecordItemCollection collection = searcher.GetMatchingItems()[0]; 

            string resultText = "Results count : " + collection.Count;

    I used X-ray to look into the Radiology lab results I uploaded and don't see anything wrong. Neither can I retrieve useing CommonData. Can you please help?
    - <thing>
      <thing-id version-stamp="fbad7524-d2ec-41d4-88ba-d6ed33023bc8">4fdb07ca-a44b-4e29-9a87-828fc6688289</thing-id>
      <type-id name="Radiology Lab Result">e4911bd3-61bf-4e10-ae78-9c574b888b8f</type-id>
      <thing-state>Active</thing-state>
      <eff-date>2010-07-26T11:52:44.073Z</eff-date>
    + <created>
    + <updated>
    - <data-xml>
    - <radiology-lab-results>
    + <when>
      <title>1.2.840.114257.0.1122506739231060045750004100002</title>
      <result-text>This is a test report. No real value. by WZ</result-text>
      </radiology-lab-results>
    - <common>
      <client-thing-id>1.2.840.114257.0.1122506739231060045750004100002</client-thing-id>
      </common>
      </data-xml>
      </thing>

    Monday, July 26, 2010 6:46 PM
  • Since you can see it in xray, we know that it's getting successfully inserted into the record, and it looks like the code that you are using is correct.

    The most likely thing is that your fetching application doesn't have priviledge to see the Radiology lab results data type, so I'd check that in the Application Configuration Center. You can verify that this is the case in your code with the following:

    List<Guid> items = new List<Guid>();
    items.Add(RadiologyLabResults.TypeId);
    Collection<HealthRecordItemTypePermission> permissions =
            PersonInfo.SelectedRecord.QueryPermissions(items);

    and then look in permissions to see what access your program has.

    If that's not it, my best guess is that you aren't looking at the same record in xray as you are in your fetching program.  

    • Marked as answer by W.Z. _ Tuesday, July 27, 2010 4:37 PM
    Monday, July 26, 2010 9:03 PM
  • Hi Eric, you are absolutly right. My fault I forgot to give application priviledge to see Radiology lab results, I bet it's also the reason of unable to see HealthAssessment through the CommonData.ClientID. Specific error message will help others in the future.

    Do you think it's a good practice to assign StudyUID to Radiology lab results so it can be searched directly, comparing assign CommonData.ClientID and have to search the MedicalImageStudy first, retrieve the relationship, then search by the ClientID?

    Thanks a lot to you and Aneesh for helping me. -W.Z

    Tuesday, July 27, 2010 2:36 PM
  • Glad that it's working for you.

    I think I'd do both - assign the studyuid and set the clientid...

    Tuesday, July 27, 2010 4:29 PM