Skip to main content
Guide
DG-3091
Status
Active
Version
1.0
Created
Updated

Reading & Development: 1 hour

Quick Intro

This guide will describe the steps to remove a Clinical Document. If your software product uploads Clinical Documents then you must have the option for your users to remove Clinical Documents that they have uploaded. Your software/user will only be allowed to remove documents which have been uploaded from the same Organisation.

In this example, you will;

  • Remove a clinical document
  • Verify some code against My Health Record Conformance use cases.

Step 1: Modify the form and code

1. Add a new button labelled Remove Document on the My Health Record Landing Page form as shown in the screenshot below.

mhr-guide7-removedocument-1.png
My Health Record Remove Document

2. Add the following additional namespace in the class.

using Nehta.VendorLibrary.PCEHR.RemoveDocument;

3. Double click on the Remove button and add the following code on the button click event. Note the selectedDocument.DocumentId which provides the Id of the Clinical Document to be removed.

private void btnRemove_Click(object sender, EventArgs e)
{
    header.IhiNumber = IHINumber;
    var selectedDocument = (PatientDocument)lstDocumentList.SelectedItem;

    // Create the client 
    RemoveDocumentClient removeDocumentClient = new RemoveDocumentClient(
        new Uri("https://services.svt.gw.myhealthrecord.gov.au/removeDocument"), cert, cert);

    // Add server certificate validation callback
    ServicePointManager.ServerCertificateValidationCallback += ValidateServiceCertificate;

    try
    {
        var request = new removeDocument()
        {
            // this should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
            documentID = selectedDocument.DocumentId, // "document unique id"
            // reasonForRemoval should be one of:
            // removeDocumentReasonForRemoval.IncorrectIdentity
            // removeDocumentReasonForRemoval.Withdrawn
            reasonForRemoval = removeDocumentReasonForRemoval.Withdrawn 
        };

        // Invoke the service
        var responseStatus = removeDocumentClient.RemoveDocument(header, request);

        // Get the soap request and response
        string soapRequest = removeDocumentClient.SoapMessages.SoapRequest;
        string soapResponse = removeDocumentClient.SoapMessages.SoapResponse;

        txtSOAPRequest.Text = soapRequest;
        txtSOAPResponse.Text = soapResponse;
    }
    catch (FaultException fex)
    {
        // Handle any errors
        txtError.Text = fex.Message;
    }
}

4. Run the application and remove a document. If document is removed successfully, the following is the SOAP response which is returned with a success message. The <soap:Header> element contents have been removed for readability.

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<S:Body xml:id="Id-0001592445791782-000000000080089e-1" xmlns:S="http://www.w3.org/2003/05/soap-envelope"><ns:removeDocumentResponse xmlns:ns="http://ns.electronichealth.net.au/pcehr/xsd/interfaces/RemoveDocument/1.0"><ns:responseStatus><ns1:code xmlns:ns1="http://ns.electronichealth.net.au/pcehr/xsd/common/CommonCoreElements/1.0">PCEHR_SUCCESS</ns1:code><ns1:description xmlns:ns1="http://ns.electronichealth.net.au/pcehr/xsd/common/CommonCoreElements/1.0">Document is Successfully Removed</ns1:description><ns1:details xmlns:ns1="http://ns.electronichealth.net.au/pcehr/xsd/common/CommonCoreElements/1.0"/></ns:responseStatus></ns:removeDocumentResponse>
</S:Body>
</soap:Envelope>

Step 2: Use Case 203 (UC.CIS.203)

Test Case IDPCEHR_CIS_017887
ObjectiveIf the Clinical Information System uploads clinical documents that are removed from the PCEHR System by the healthcare provider organisation, it shall provide an ability to identify which locally created clinical documents have been removed from the PCEHR System.
How to evaluate


Create a clinical document for a healthcare recipient using the software and upload the clinical document to the PCEHR System.

Perform an operation to remove the document from the PCEHR System.

Perform an operation to identify the document on the local system:

 

a. Verify that the software provides a mechanism in the local system to identify that clinical document that has been removed from the PCEHR System.

This test case requires that your software must have a mechanism to record whether an uploaded Clinical Document has been removed. The screenshot below provides a very basic modification to a locally stored Document History which displays the logged document removal date.

mhr-guide7-removedocument-2.png
MHR Remove Document Test Case

The code below is a sample which could be used to fire a method to track that the Clinical Document has been removed successfully from the My Health Record system.

// Invoke the service
var responseStatus = removeDocumentClient.RemoveDocument(header, request);

if (responseStatus.responseStatus.description.Contains("Success"))
{
    // Update the document history for the removed document.
}
Test Case IDPCEHR_CIS_019377
ObjectiveIf the Clinical Information System has the ability to upload documents to the PCEHR System, the Clinical Information System shall provide an ability to remove previously uploaded clinical documents where there is a change or an error in the data used to create the uploaded clinical documents.
How to evaluate

Create a clinical document for a healthcare recipient using the software, and perform the following steps:

1. Upload the document to the PCEHR System.

2. Remove the document from the PCEHR System.

Now:

a. Verify that steps 1 - 2 above can be performed without error.

This is the test case which requires your software to include Remove functionality if you conduct uploading.

mhr-guide7-removedocument-3.png
MHR Remove Document Test Case

Conclusion

In this guide we have implemented the removeDocument web service. This is currently the last guide walking through the My Health Record B2B interface.
We would really appreciate any feedback on this set of guides, please contact us at [email protected].

 

View All | Back | Completed: My Health Record B2B Developer Guides