Go to top of page

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.

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://b2b.ehealthvendortest.health.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;
    }
}

Important 
Please be sure that you set an appropriate value for reasonForRemoval. This may involve prompting your users, If the value is set as Withdrawn the patient will still be able to see this removed document as a line item within their My Health Record (although they will not be able to see the content), and the provider can reinstate the document by sending a replacement. If the value is set to IncorrectIdentity then the document cannot be reinstated.

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>

Use Case UC.CIS.203 - Remove a Clinical Document

Test Case ID

PCEHR_CIS_017887

Objective

If 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 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 ID

PCEHR_CIS_019377

Objective

If 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 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