Use Results
class for visualisations
#1468
Labels
code quality
code & performance improvements that do not affect user functionality
frontend
changes to the angular frontend
Results
is an abstract class in the frontend that is designed to handle various types of results based on a query. A child class will have some parameters of its own (or none), and fetch results when the query or the parameters change.This class is currently used to fetch the (paged) document results for a query, but it was written so that it could also be the basis for visualisations. The advantage of this is that
Results
includes some logic that won't need to be repeated for every visualisation. It also results in a more consistent flow in the application.However, visualisations are complex modules that tend to include some complex logic of their own, so this refactor isn't trivial
To fully use the
Results
class, I would propose (in this order):FrequentWordsResults
class that generates results for the wordcloud.NgramResults
class that generates results for the ngram visualisation.DocumentFreqResult
class that generates a histogram of document frequency in relation to a keyword or date field. Create subclasses for those two scenarios. Used for the document frequency graph.TermFreqResult
class that generates the frequency of the search term in relation to a keyword or date field. Used for the term frequency graph.Some considerations:
Result
already works.NgramResult.fetch()
so it uses the cached data in the same way thatNGramComponent.loadGraph()
currently does.DocumentFreqResult
for the smaller interval?TermFreqResult
should be relatively straightforward. However, the barchart module is a beast - refactoring it to use theDocumentFreqResult
orTremFreqResult
is welcome but not trivial.Bonus points:
AggregationResult
class that fetches the document counts displayed in the multiple choice filter. Could also be based onDocumentFreqResult
.CountResult
class that just fetches the total number of documents, that can be used in the download component (used to determine the download type).The text was updated successfully, but these errors were encountered: