The Results Manager web service provides methods for requesting the results from completed jobs, including both free statistics and
purchasing and downloading cleansed data.
The web service definition is available at
https://webservices.data-8.co.uk/batch/v1.0/resultsmanager.asmx?WSDL.
In order to retrieve the results of a data cleansing job, the job must have finished. This can be determined using the
GetJobDetails method from the Job Manager web service.
The methods in this service can be roughly broken down into three sections:
-
Statistics - statistics on the success rate of the applied data cleansing services can be freely obtained once the job
has finished. Statistics are broken down into sections - the list of available sections can be retrieved using the
GetDataQualityAuditSections method, and the statistics in one or all of
these sections can be retrieved using the GetDataQualityAudit method.
-
Purchasing - a data cleansing purchase is made up of one or more services. The quote containing the full list of
available services can be retrieved using the GetAvailableServices method. If any
services are not required or have options that need to be modified, a changed list of services can be passed to the
UpdateQuote method to get a new quote. If services have been removed, the
GetAlternativeServices method can be used to get the details of services that can
be added back into the quote.
If data has been previously purchased from Data8Online, a quote for an idential set of data cleansing services
for another job can be retrieved from the GetQuoteFromPreviousPurchase method.
Once the quote has been reviewed and accepted, it can be passed to the PurchaseResults method
to purchase the cleansed data defined in the quote.
-
Downloading - after cleansed data has been purchased, the process of generating the cleansed file can be monitored using
the GetResultStatus method. Once the cleansed file is available, it can be downloaded
using the GetResultsSize and DownloadResults
methods. The details of what data is contained in what column in the cleansed file can be retrieved using the
GetOutputFormat method.
Various reports may also be available containing information about the quality of the data. Some reports may be freely available once the original
data cleansing job has finished, and others may only be available once they have been purchased. Details of all the reports that are available at
the current time can be retrieved using the GetReportDetails method, and the contents of a report
can be downloaded using the DownloadReport method.
Once cleansed data has been produced, a printable invoice can be downloaded using the DownloadInvoice
method.
The following code sample illustrates how to purchase and download a specific set of services.
/// <summary>
/// Downloads a cleansed data file with any TPS telephone numbers removed.
/// </summary>
/// <param name="jobName">The identifier of the data cleansing job from which to purchase the results.</param>
/// <param name="poNum">The purchase order number to use to purchase the results.</param>
/// <returns>The path of the cleansed data file.</returns>
private string DownloadCleansedData(string jobName, string poNum)
{
// Get a quote for the job.
ResultsManager proxy = new ResultsManager();
Quote quote = proxy.GetAvailableServices(Username, Password, jobName);
// Find the TPS service in the quote.
Service tps = null;
foreach (Service service in quote.Services)
{
if (service.Name == "TPSExisting")
{
tps = service;
break;
}
}
// If the TPS service isn't available, don't download any data.
if (tps == null)
return null;
// Change the TPS service options to suppress any TPS telephone numbers
// rather than appending flags.
foreach (ServiceOption option in tps.Options)
{
if (option.Name == "SuppressionType")
{
option.Value = "SuppressField";
break;
}
}
// Get a new quote containing only the TPS suppression service.
quote = proxy.UpdateQuote(Username, Password, jobName, new Service[] { tps });
// Purchase the results of the service.
int cleansedId = proxy.PurchaseResults(Username, Password, jobName, quote.Services, poNum);
// Wait for the process to finish.
while (true)
{
Thread.Sleep(TimeSpan.FromSeconds(10));
int status = proxy.GetResultStatus(Username, Password, cleansedId);
if (status == 100)
break;
}
// Create a temporary file to hold the cleansed data.
string path = Path.GetTempFileName();
// Download the cleansed data in 4KB chunks and save it to the temporary file.
long length = proxy.GetResultsSize(Username, Password, cleansedId);
long read = 0;
while (read < length)
{
byte[] buf = proxy.DownloadResults(Username, Password, cleansedId, read, Math.Min(4096, length - read));
using (Stream stream = File.Open(path, FileMode.Append, FileAccess.Write))
{
stream.Write(buf, 0, buf.Length);
}
read += buf.Length;
}
return path;
}