Пример #1
0
        public void GetMedicareOverview()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getView"
            // production endpoint is "https://services.ehealth.gov.au/getView"
            GetViewClient getViewClient = new GetViewClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getView"), cert, cert);

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

            try
            {
                getView request = new getView()
                {
                    // For MedicareOverview
                    view = new medicareOverview()
                    {
                        fromDate = DateTime.Now.AddDays(-10),
                        toDate   = DateTime.Now,
                        //versionNumber can be found in the "PCEHR View Service - Technical Service Specification" via
                        //https://digitalhealth.gov.au/implementation-resources/national-infrastructure/EP-2109-2015
                        //If the specification doesn't specify the version number then it is 1.0
                        //Currently 1.0 and 1.1
                        versionNumber = "1.1"
                    }
                };

                var responseStatus = getViewClient.GetView(header, request);

                // Treat response like a getDocument - unzip package
                if (responseStatus.view != null)
                {
                    var zipfile = responseStatus.view.data;
                    // and Unzip
                }

                // Get the soap request and response
                string soapRequest  = getViewClient.SoapMessages.SoapRequest;
                string soapResponse = getViewClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
Пример #2
0
        public void GetHealthRecordOverview()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getView"
            // production endpoint is "https://services.ehealth.gov.au/getView"
            GetViewClient getViewClient = new GetViewClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getView"), cert, cert);

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

            try
            {
                getView request = new getView()
                {
                    // Creates a healthRecordOverView
                    view = new healthRecordOverView()
                    {
                        clinicalSynopsisLength = 200,
                        // versionNumber can be found in the "PCEHR View Service - Technical Service Specification" via
                        // https://digitalhealth.gov.au/implementation-resources/national-infrastructure/EP-2109-2015
                        // If the specification doesn't specify the version number then it is 1.0
                        versionNumber = "1.1"
                    }
                };

                var responseStatus = getViewClient.GetView(header, request);

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

                // Convert XML response into Class for healthRecordOverview
                XmlDocument xml = new XmlDocument();
                xml.PreserveWhitespace = true;
                xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data));
                healthRecordOverviewResponse data = new healthRecordOverviewResponse();
                data = (healthRecordOverviewResponse)DeserialiseElementToClass(xml.DocumentElement, data);
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
Пример #3
0
        public void Run()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/gainPCEHRAccess"
            // production endpoint is "https://services.ehealth.gov.au/gainPCEHRAccess"
            GainPCEHRAccessClient gainPcehrAccessClient = new GainPCEHRAccessClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/gainPCEHRAccess"), cert, cert);

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

            // Create the access request
            gainPCEHRAccessPCEHRRecord accessRequest = new gainPCEHRAccessPCEHRRecord();

            // if gaining access without a code, authorisationDetails is not required
            // if gaining access with a code, include authorisationDetails, accessCode and accessType
            // if gaining emergency access, include authorisationDetails and set accessType to “EmergencyAccess”
            // Only include the below to pass an access code or gain emergency access
            accessRequest.authorisationDetails = new gainPCEHRAccessPCEHRRecordAuthorisationDetails();

            // "patient access code" is not required if the patient has open access for there record
            accessRequest.authorisationDetails.accessCode = "";

            accessRequest.authorisationDetails.accessType = gainPCEHRAccessPCEHRRecordAuthorisationDetailsAccessType.AccessCode;


            gainPCEHRAccessResponseIndividual individual = new gainPCEHRAccessResponseIndividual();

            try
            {
                // Invoke the service
                responseStatusType responseStatus = gainPcehrAccessClient.GainPCEHRAccess(header, accessRequest, out individual);

                // Get the soap request and response
                string soapRequest  = gainPcehrAccessClient.SoapMessages.SoapRequest;
                string soapResponse = gainPcehrAccessClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
        public void Remove()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.LudwigHOBBS);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Create the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/removeDocument"
            // production endpoint is "https://services.ehealth.gov.au:443/removeDocument"
            RemoveDocumentClient removeDocumentClient = new RemoveDocumentClient(
                new Uri("https://b2b.ehealthvendortest.health.gov.au/removeDocument"), cert, cert);

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

            try
            {
                var request = new removeDocument()
                {
                    // this should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                    documentID = "2.25.262187743541392638493047310439698728609",
                    // reasonForRemoval should be one of:
                    // removeDocumentReasonForRemoval.IncorrectIdentity
                    // removeDocumentReasonForRemoval.ElectToRemove
                    // 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;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
Пример #5
0
        public void Run()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.MaxwellThomas);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Create the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getDocument"
            // production endpoint is "https://services.ehealth.gov.au/getDocument"
            GetDocumentClient getDocumentClient = new GetDocumentClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getDocument"), cert, cert);

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

            // Create a request
            List <RetrieveDocumentSetRequestTypeDocumentRequest> request =
                new List <RetrieveDocumentSetRequestTypeDocumentRequest>();

            // Set the details of the document to retrieve
            request.Add(new RetrieveDocumentSetRequestTypeDocumentRequest()
            {
                // This should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                DocumentUniqueId = "2.25.5801464458231145855085038232999883849",
                // This should be the value of "repositoryUniqueId" in the GetDocumentList response
                RepositoryUniqueId = "1.2.36.1.2001.1007.10.8003640002000050"
            });

            try
            {
                // Invoke the service
                RetrieveDocumentSetResponseType response = getDocumentClient.GetDocument(header, request.ToArray());
            }
            catch (FaultException e)
            {
                // Handle any errors
            }
        }
        public void Run()
        {
            //certSerial: "06fba6",
            //serialHPIO: "8003629900019338",


            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.FrankHarding);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist"
            // Production endpoint is "https://services.ehealth.gov.au/doesPCEHRExist"
            DoesPCEHRExistClient doesPcehrExistClient = new DoesPCEHRExistClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist"), cert, cert);

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

            try
            {
                // Invoke the service
                doesPCEHRExistResponse response = doesPcehrExistClient.DoesPCEHRExist(header);

                Console.WriteLine($"Success Full at : {DateTime.Now.ToString()}");
                Console.WriteLine($"PCEHR Exists: {response.PCEHRExists.ToString()}");
                Console.WriteLine($"Access Code Required: {response.accessCodeRequired.ToString()}");
                Console.WriteLine($"AccessCodeRequiredSpecified: {response.accessCodeRequiredSpecified.ToString()}");

                // Get the soap request and response
                string soapRequest  = doesPcehrExistClient.SoapMessages.SoapRequest;
                string soapResponse = doesPcehrExistClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
        public void Run()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getChangeHistoryView"
            // production endpoint is "https://services.ehealth.gov.au/getChangeHistoryView"
            GetChangeHistoryViewClient changeHistoryViewClient = new GetChangeHistoryViewClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getChangeHistoryView"), cert, cert);

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

            try
            {
                // Invoke the service
                // if you run GetDocumentList first, you will get a list of document ids in the response
                // the "value" attribute in the <ns3:ExternalIdentifier> element provides the unique document id
                var changeHistoryView = changeHistoryViewClient.GetChangeHistoryView(
                    header, new getChangeHistoryView()
                {
                    documentID = "2.25.33982669477651998710317483962006911980"
                }
                    );
            }
            catch (FaultException e)
            {
                // Handle any errors
            }
        }
Пример #8
0
        public void GetPathologyView()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getView"
            // production endpoint is "https://services.ehealth.gov.au/getView"
            GetViewClient getViewClient = new GetViewClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getView"), cert, cert);

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

            try
            {
                getView request = new getView()
                {
                    // Creates a pathologyReportView
                    view = new pathologyReportView()
                    {
                        //2 years = 365 * 2 Days
                        fromDate = DateTime.Now.Subtract(new TimeSpan((365 * 2), 0, 0, 0)),
                        toDate   = DateTime.Now,
                        // versionNumber can be found in the "PCEHR View Service - Technical Service Specification" via
                        // https://digitalhealth.gov.au/implementation-resources/national-infrastructure/EP-2109-2015
                        // If the specification doesn't specify the version number then it is 1.0
                        versionNumber = "1.0"
                    }
                };

                var responseStatus = getViewClient.GetView(header, request);

                // Convert XML response into Class for pathologyReportView
                XmlDocument xml = new XmlDocument();
                xml.PreserveWhitespace = true;
                xml.LoadXml(Encoding.Default.GetString(responseStatus.view.data));
                pathologyReportViewResponse data = new pathologyReportViewResponse();
                data = (pathologyReportViewResponse)DeserialiseElementToClass(xml.DocumentElement, data);

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

                foreach (var item in data.pathologyReport.OrderByDescending(x => x.reportInformation.CDAeffectiveTime))
                {
                    Console.WriteLine($"");
                    Console.WriteLine($"##################################################################################");
                    Console.WriteLine($"DocumentId: {item.reportInformation.documentId}");
                    Console.WriteLine($"DocumentLink: {item.reportInformation.documentLink}");
                    Console.WriteLine($"ReportName: {item.reportInformation.reportName}");
                    Console.WriteLine($"PathologistLocalReportId: {item.reportInformation.pathologistLocalReportId}");
                    Console.WriteLine($"ReportStatus(code): {item.reportInformation.reportStatus.code}");
                    Console.WriteLine($"DateTimeRequested: {item.testRequesterInformation.dateTimeRequested}");
                    Console.WriteLine($"CDAeffectiveTime: {item.reportInformation.CDAeffectiveTime}");
                    Console.WriteLine($"DateTimeReportAuthored: {item.reportInformation.dateTimeReportAuthored}");
                    Console.WriteLine($"DateTimeAuthorisation: {item.reportInformation.dateTimeAuthorisation}");
                    foreach (var Report in item.pathologyTestResult)
                    {
                        Console.WriteLine($"  -------------------------------------------------");
                        Console.WriteLine($"  TestResultName(code): {Report.testResultName.code}");
                        Console.WriteLine($"  TestResultName(displayName): {Report.testResultName.displayName}");
                        Console.WriteLine($"  TestResultName(originalText): {Report.testResultName.originalText}");
                        Console.WriteLine($"  PathologyDiscipline(code): {Report.pathologyDiscipline.code}");
                        Console.WriteLine($"  OverallTestResultStatus(code): {Report.overallTestResultStatus.code}");
                        Console.WriteLine($"  SpecimenCollectionDate: {Report.specimenCollectionDate}");
                    }
                }
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
Пример #9
0
        public void Upload()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.CalebDerrington);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Create the client
            // SVT endpoint is https://b2b.ehealthvendortest.health.gov.au/uploadDocument
            // production endpoint is https://services.ehealth.gov.au/uploadDocument
            UploadDocumentClient uploadDocumentClient = new UploadDocumentClient(
                new Uri("https://b2b.ehealthvendortest.health.gov.au/uploadDocument"), cert, cert);

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

            byte[] packageBytes = File.ReadAllBytes(@"C:\temp\MyHealthRecordTools\CDAPackager\Output\LastOutputRun\CdaPackage.zip"); // Create a package

            // Create a request to register a new document on the PCEHR.
            // Create a request to register a new document on the PCEHR.
            // Format codes and format code names are not fixed, and it is recommended for them to be configurable.
            // formatCode is the Template Package ID for each clinical document, formatCodeName is the Document type
            // please find specific details for each clinical document type on https://digitalhealth.gov.au/implementation-resources/clinical-documents
            // formatCodeName can be read in Table 3 of the Document Exchange Service Technical Service Specification
            // For example (formateCodeName - formatCode):
            // "eHealth Dispense Record" - 1.2.36.1.2001.1006.1.171.5
            // "Pathology Report" - 1.2.36.1.2001.1006.1.220.4
            // "Diagnostic Imaging Report" - 1.2.36.1.2001.1006.1.222.4
            // "Discharge Summary" - 1.2.36.1.2001.1006.1.20000.18
            // "eHealth Dispense Record" - 1.2.36.1.2001.1006.1.171.4
            // "Goals of Care" - 1.2.36.1.2001.1006.1.100001.1
            // "Event Summary" - 1.2.36.1.2001.1006.1.16473.12
            ProvideAndRegisterDocumentSetRequestType request = uploadDocumentClient.CreateRequestForNewDocument(
                packageBytes,
                "1.2.36.1.2001.1006.1.16473.12",
                "Event Summary",
                //You must chooose a valid type below
                HealthcareFacilityTypeCodes.Hospitals,
                PracticeSettingTypes.GeneralHospital
                );

            // To supercede / amend an existing document, the same UploadDocument call is used. However, the request is
            // prepared using the CreateRequestForReplacement function.

            // Note that the new document must have a different UUID/GUID to the one it is replacing.
            // the uuidOfDocumentToReplace must be converted to OID format and include the repository OID.
            // (i.e. a document being replaced in the My Health Record repository is)

            //ProvideAndRegisterDocumentSetRequestType request = uploadDocumentClient.CreateRequestForReplacement(
            //   packageBytes,
            //   "1.2.36.1.2001.1006.1.220.4",
            //    "Pathology Report",
            //   HealthcareFacilityTypeCodes.Hospitals,
            //   PracticeSettingTypes.GeneralHospital,
            //   "2.25.311256170906902265756795034001543718058" //Document Id of doc to replace
            //   );

            // When uploading to the NPDR where the repository unique ID, document size and hash may need to be included
            // in the metadata, use the utility function below.

            // uploadDocumentClient.AddRepositoryIdAndCalculateHashAndSize(request, "REPOSITORY_UNIQUE_ID");

            try
            {
                // Invoke the service
                RegistryResponseType registryResponse = uploadDocumentClient.UploadDocument(header, request);

                // Get the soap request and response
                string soapRequest  = uploadDocumentClient.SoapMessages.SoapRequest;
                string soapResponse = uploadDocumentClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
Пример #10
0
        public void Run()
        {
            // NASH certificate should be used here, NOT the HI certificate the NASH certificate can be found in the NASH PKI Test Kit
            // certificate needs to be installed in the right place
            // The "Issue To" field of a NASH certificate looks like general (or something different)."HPI-O".electronichealth.net.au
            // "Serial Number" can be found in the details once the certificate is installed.e.g. in Windows, certificates can be found in Certs.msc

            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.FrankHarding);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Instantiate the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getDocumentList"
            // production endpoint is "https://services.ehealth.gov.au/getDocumentList"
            GetDocumentListClient documentListClient = new GetDocumentListClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getDocumentList"), cert, cert);

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

            // Create a query
            AdhocQueryBuilder adhocQueryBuilder = new AdhocQueryBuilder(header.IhiNumber, new[] { DocumentStatus.Approved });

            adhocQueryBuilder.ServiceStartTimeFrom = new ISO8601DateTime(new DateTime(2018, 03, 18));
            adhocQueryBuilder.ServiceStopTimeTo    = new ISO8601DateTime(new DateTime(2020, 07, 17));

            adhocQueryBuilder.ClassCode = new List <ClassCodes>()
            {
                ClassCodes.AdvanceCareDirectiveCustodianRecord,
                ClassCodes.AdvanceCareInformation
            };

            //adhocQueryBuilder.TypeCode = new List<ClassCodes>()
            //{
            //  ClassCodes.AdvanceCareDirectiveCustodianRecord,
            //  ClassCodes.AdvanceCareInformation
            //};

            // To further filter documents, build on the adhocQueryBuilder helper functions
            // For example, filtering on document type
            //adhocQueryBuilder.ClassCode = new List<ClassCodes>() {ClassCodes.AdvanceCareInformation};
            // See Table 3 XDSDocumentEntry Document Type and Class Code value set from
            // the Document Exchange Service Technical Service Specification

            // Create the request using the query
            AdhocQueryRequest queryRequest = adhocQueryBuilder.BuildRequest();


            try
            {
                // Invoke the service
                AdhocQueryResponse queryResponse = documentListClient.GetDocumentList(header, queryRequest);

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

                // Process data into a more simple model
                if (queryResponse.RegistryObjectList.ExtrinsicObject == null)
                {
                    Console.WriteLine($"Total Documents: 0");
                }
                else
                {
                    XdsRecord[] data        = XdsMetadataHelper.ProcessXdsMetadata(queryResponse.RegistryObjectList.ExtrinsicObject);
                    int         UseTimeZone = 11;
                    // For displaying the data in a list
                    Console.WriteLine($"Total Documents {data.Count().ToString()}");
                    Console.WriteLine($"{"Document Date".PadRight(23)} | {"Service Date".PadRight(23)} | {"Document".PadRight(35)} | {"Org".PadRight(35)} | {"Org Type".PadRight(35)}|");
                    Console.WriteLine($"================================================================================================================================================================================");
                    foreach (var row in data.OrderByDescending(x => x.creationTimeUTC))
                    {
                        Console.WriteLine($"{row.creationTimeUTC.Add(TimeSpan.FromHours(UseTimeZone)).ToString().PadRight(23)} | {row.serviceStartTimeUTC.Add(TimeSpan.FromHours(UseTimeZone)).ToString().PadRight(23)} | {row.typeCodeDisplayName.PadRight(35)} | {row.authorInstitution.institutionName.PadRight(35)} | {row.healthcareFacilityTypeCodeDisplayName.PadRight(35)}");
                        //Console.WriteLine($"DocumentId: {row.documentId}");
                        //Console.WriteLine($"ClassCode DisplayName: {row.classCodeDisplayName}");
                        //Console.WriteLine($"TypeCode DisplayName: {row.typeCodeDisplayName}");
                        //Console.WriteLine($"Creation Time UTC: {row.creationTimeUTC.Add(TimeSpan.FromHours(UseTimeZone)).ToString()}");
                        //Console.WriteLine($"Service Start Time UTC: {row.serviceStartTimeUTC.Add(TimeSpan.FromHours(UseTimeZone)).ToString()}");
                        //Console.WriteLine($"Service Stop Time UTC: {row.serviceStopTimeUTC.Add(TimeSpan.FromHours(UseTimeZone)).ToString()}");
                        //Console.WriteLine($"Healthcare Facility TypeCode DisplayName: {row.healthcareFacilityTypeCodeDisplayName}");
                        //Console.WriteLine($"Repository Unique Id: {row.repositoryUniqueId}");
                        //Console.WriteLine($"Status: {row.status}");
                        //Console.WriteLine($"Remove Reason: {row.removeReason}");
                        //Console.WriteLine($"Record Version: {row.recordVersion}");
                        //Console.WriteLine($"AuthorInstitution.InstitutionName: {row.authorInstitution.institutionName}");



                        // Convert dates from UTC to local time
                        //row.creationTimeUTC.ToLocalTime();
                        //row.serviceStopTimeUTC.ToLocalTime();

                        // Document name
                        //row.classCodeDisplayName

                        // Organisation
                        //row.authorInstitution.institutionName

                        // Organisation Type
                        //row.healthcareFacilityTypeCodeDisplayName

                        // Identifiers to retrieve the document
                        //row.repositoryUniqueId
                        //row.documentId
                    }
                }
            }
            catch (FaultException e)
            {
                // Handle any errors
            }
        }