I have data in my fuclro client db that has #inst attributes. I need to do basic time series analysis on these. Ideally I'd store the instance attributes of the graph sorted so that the evaluations are more efficient. I've always been confused about best practices for this type of situation. The data is just data for analysis and its also related to the UI. Where would one suggest I store this data analysis type data structure? As part of the client db or separately? Is there a way to associate it with the client db graph but in sorted order? This is sort of a general application architecture question and I'm curious as to how more experienced developers think about this problem. I mean, you could also do the operation on the server but these are not big compute intensive things. Still, if I have a couple thousand instances I'd like to have them sorted to maintain some level of organization.
Fulcro has no opinion. You can do all manner of things: • Normalize the items and use normalized-state/sort-idents-by to actually post-sort them in the normalized db • Don’t normalize the data, and instead keep it in a data object with whatever structure you want • Do the sorting and processing all as part of the analysis step (as a mutation)
etc
Fulcro’s main job is coordination with server, and pure-as-possible rendering of a normalized data model that you invent with reasonably optimal UI refresh cost.
I personally analyze the trade-offs of doing it in various layers. Sometimes it works just to sort it in the UI as you render. Surprisingly well for small to moderate sized collections. Sometimes I do the sorting and paginating in other data structures as part of my data processing story..e.g. see the state machine for RAD reports, where I load the data, filter it, sort it, paginate it, and store the results of all of that into a cached area of the report itself. I actually save the result of each step so the re-sorting can be done on the already-filtered data, and pagination is just working with subvec of an already sorted collection.
but for large data sets I often will not normalize the data (esp if it is a visualization where normalization helps nothing but costs a lot). Then I can just build what I need into that data blob.