Minor memory optimizations

Certain parts of the code were generating unnecessarily large objects
which causes high memory usage and slowdown.
Change interface to use topN as variable

This reverts a previous change where the variable name was accidentally
changed to minPatients which is supposed to be another cutoff variable
which has not yet been implemented.
Add interface stub for minPatients

This still needs to be implemented in both generateDataFromSql and
generateCovariates.
Add topK to interface
General cleaning and working on TODOs