none
Manually add (upload) CCD xml and export (download) CCD xml in C# RRS feed

  • Question

  •  

    To HealthVault team,

    (since system of the forum states "Body text cannot contain images or links until we are able to verify your account", I can't upload image or post a link here...I will try to post another question once I can upload image to give you better picture.)


    Right now We have two problems:

    1. Is it possible to do manually CCD add (upload) function in C#?

    We have the working code of CCD upload function with "auto commit".

                XmlDocument ccdaDocumentData = new XmlDocument();
                XmlTextReader reader = new XmlTextReader(ccdFileName);
                ccdaDocumentData.Load(reader);  //fileUpload.FileContent

                HealthRecordItem ccda = new HealthRecordItem(new Guid("9c48a2b8-952c-4f5a-935d-                            f3292326bf54"), ccdaDocumentData);
                _newCcdaItem = ccda;

                // Make the offline call to store the CCD in the patient's HealthVault record. 
                OfflineWebApplicationConnection connection = new OfflineWebApplicationConnection(new                          Guid(personID));//pi.PersonId
                HealthRecordAccessor receordAccessor = new HealthRecordAccessor(connection, new                                Guid(recordID));//pi.SelectedRecord.Id
                receordAccessor.NewItem(_newCcdaItem);

    This C# code auto commit the CCD data that is not duplicate in measurement.  

    However, we want to upload CCD xml file with "Manually commit" as HealthVault page.

    In the HealthVault page, the user actually has an option (At the top of the page, click Add ->CCD ->go to left hand side there is Documents index -> CCDs -> for that CCD doc, click "Add items") to add item manually into measurement or not after the user upload a CCD xml file.

    We want to have a similar function for user to manually choose the items to be added as well (rather than just auto commit all data).

    So, is it possible to implement "Manually commit" in C#? How to do it...?




    2. Is it possible to implement "Export" CCD function as HeathVault in C#?

    Our goal is to implement a download CCD function in C# which returns the same result as "Export" on HealthVault.

    Then we got an Exported file and its name is "User name.xml"

    What I tried so far is:

                // Make the offline call to store the CCDA in the patient's HealthVault record. 
                OfflineWebApplicationConnection connection = new OfflineWebApplicationConnection(new                          Guid(personID));//pi.PersonId
                HealthRecordAccessor receordAccessor = new HealthRecordAccessor(connection, new                                Guid(recordID));//pi.SelectedRecord.Id

                HealthRecordSearcher searcher = receordAccessor.CreateSearcher();
                HealthRecordFilter filter = new HealthRecordFilter();
                searcher.Filters.Add(filter);
                Guid[] typeIds = { new Guid("9c48a2b8-952c-4f5a-935d-f3292326bf54")//CCD
                                   //,new Guid("3d34d87e-7fc1-4153-800f-f56592cb0d17")//weight
                                   //,new Guid("ca3c57f4-f4c1-4e15-be67-0a3caf5414ed")//blood pressure
                                   //,new Guid("879e7c04-4e8a-4707-9ad3-b054df467ce4")//blood glucose
                                  };
                //docs.microsoft.com/en-us/healthvault/reference/datatypes/


                foreach (Guid typeId in typeIds)
                    filter.TypeIds.Add(typeId);


                filter.View.Sections = HealthRecordItemSections.All |                                                                                Microsoft.Health.HealthRecordItemSections.Xml;

                //HealthRecordItemSections.Core |
                //HealthRecordItemSections.Xml |
                //HealthRecordItemSections.Audits;

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

                List<string> items = new List<string>();
                foreach (HealthRecordItem thing in things)
                {
                    items.Add(thing.GetItemXml(filter.View.Sections));
                }
                return (items);


    Then we can get the CCDs xml files that "user upload" (For example, I upload CCD_0~CCD_2 on my account) on HealthVault.

    However, these CCD xml files (even if combine these CCD into one file) are completely different from "User name.xml" (which is using the "Export" function to export CCD file on HealthVault).

    We think the difference is that the CCD_0~CCD_2 file I got are just the CCD files user upload. 
    And HealthVault will take user committed upload file to read and write into one HealthVault's own user personal CCD xml file.

    And then the "Export" function export the only one HealthVault's own user personal CCD xml file.

    It is correct? If not, could you please explain how HeathVault merge committed CCD xml files into one user personal CCD xml file?

    And is it possible to implement the "Export" CCD function as HeathVault page in C#? How to do it...?



    Thank you very much.

    Queens College Computer Science research team




    Sunday, November 5, 2017 6:58 PM

Answers

    1. HealthVault automatically detects CCD file type, and "auto commit" (transform to HealthVault's native data type, such as blood pressure). Each end user has a choice of doing auto commit or not for the application, during app authorization (default is doing auto commit). Application has no control over it. 
    2. HealthVault export function actually transforms HealthVault native data types (not CCD in the storage) to CCD. You should be able to retrieve the transform from HealthVault, as data type information.

    Takashi Moriyama | Senior Program Manager | Microsoft Health

    Wednesday, November 8, 2017 6:11 PM
    Moderator
  • Go to "Apps & devices" and find your application.

    Then, "Manage access". It will pop up permission UI for the application and it has the checkbox. 

    This UI (the checkbox) is always shown to end user when they authorize the application first time. 


    Takashi Moriyama | Senior Program Manager | Microsoft Health

    Monday, November 13, 2017 5:24 PM
    Moderator

All replies

    1. HealthVault automatically detects CCD file type, and "auto commit" (transform to HealthVault's native data type, such as blood pressure). Each end user has a choice of doing auto commit or not for the application, during app authorization (default is doing auto commit). Application has no control over it. 
    2. HealthVault export function actually transforms HealthVault native data types (not CCD in the storage) to CCD. You should be able to retrieve the transform from HealthVault, as data type information.

    Takashi Moriyama | Senior Program Manager | Microsoft Health

    Wednesday, November 8, 2017 6:11 PM
    Moderator

  • Your answer of question 1 is clear to us.

    However, we want to make sure that we understand your answer of question 2 correctly, so we have one more question about question 2.

    If HealthVault "export" is a functionality that transform data from native data type to CCD, is the "export" functionality exposed and available for developer? If so, how?

    Thank you for your answering.

    Thursday, November 9, 2017 2:19 PM
  • HealthVault "export" functionality is not available for developer. It is a function within HealthVault Web site.

    You can download same transform used by HealthVault Web site, if you want to implement your own function.

    https://platform.healthvault.com/platform/xsl/toccd.xsl


    Takashi Moriyama | Senior Program Manager | Microsoft Health

    Friday, November 10, 2017 6:27 PM
    Moderator
  • One more question about Question 1.

    Is there a more convenient way for user to change setting between auto-commit/manually commit in HV?

    Right now, we assume user have to set auto-commit/manually commit in HV as following:

    1. click "CCDs":
    內置圖片 1
    2. click "See items already added" of the CCD that you actually added new data (such as the first CCD) :
    內置圖片 3
    3. click "Change preference":
    內置圖片 4
    4. click the option you want (yes for aotu commit; no for manually commit):

    內置圖片 5

    However, user must click the newly not duplicated CCD data in order to change the setting of auto/manually commit. Is there other more convenient way to change the setting?

    Thanks for your help.

    Sunday, November 12, 2017 4:23 PM
  • Go to "Apps & devices" and find your application.

    Then, "Manage access". It will pop up permission UI for the application and it has the checkbox. 

    This UI (the checkbox) is always shown to end user when they authorize the application first time. 


    Takashi Moriyama | Senior Program Manager | Microsoft Health

    Monday, November 13, 2017 5:24 PM
    Moderator