Automated extraction of patient scenarios

Page 61

Figure 24. Count Query Visualisation

5.2.3 OpenCSV The final step of the application is to export the samples into a CSV file. OpenCSV [56] is CSV Parser for Java. This API was used mainly to export the subsample population to CSV after the user has created the desired population. With some research in MySQL export events, it was deduced that the standard query used for

export

i.e.

SELECT

*

INTO

OUTFILE

<filename

|

filepath>

FROM

mygrist_samples.subsample_population FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’

in MySQL did not provide enough functionality to export the data with column names,

much as how these statistical applications require the CSV data to be. This query could only export the data for the samples i.e. rows without column headers which were inconsequential. In order to design the data to be exported with column headers, MySQL procedures were required to be written in order to export the table with column names. The steps in doing so involved writing a procedure in MySQL (PL/SQL) to retrieve database information and iterate through the columns of the specified table to retrieve the column name and column data, next, procedure calls would be made to implement this procedure after which the data would be written the CSV file. Since this option seemed quite tedious given the limited time to achieve the task, OpenCSV was utilised to write the data into a CSV file. This approach, although the process seemed elaborate to complete, was, on the contrary, a better option than any other considered. The class mainly used for these purposes was the CSVWriter [57] class. This class has methods to write data sequentially or as a chunk through writeNext(String[] nextLine) and writeAll(ResultSet

rs,

Boolean

includeHeaders)

respectively,

which

were

predominantly used to accomplish the task of accurate export events. The writeNext() function 56


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.