-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor externalData in protocol #413
Comments
This looks good to me. Might not need a I don't think the protocol object should really be manipulated, since it's a configuration object. So these properties should probably want to like elsewhere, say in the session data, perhaps in a parallel data structure. (maybe the same goes for the top-level
How is this intended to work with our UIDs? |
This is independent as I see it. Once the data is loaded, an interface will determine if it requires UIDs to be present, and generate them with the logic set out in #415. Individual nodes in an external data file (even when loaded via URL) should hash to the same UID because its deterministic, right? |
Makes sense to me. I agree we shouldn't manipulate the protocol object. We don't allow duplicate keys in json, right? So there shouldn't be a name clash with the downloaded data. |
(1) The wiki describes that data may be "dynamically loaded and created by other systems in response to interview variables" (e.g., participant ID). Are we working here with that goal in mind? (2) Once loaded, is external data part of the redux state? "interfaces will use a special loader method" which "resolve with the contents of the file" implies not, but the "isLoading"/"isLoaded" flags in redux imply that it would be. (3) If external data is in redux, it looks like it would need knowledge of other state branches ( (4) Do we want to unload data that isn't needed for a stage and/or prompt? That seems wise if there are multiple large data sources, but (assuming data is in redux and not resolved directly to interfaces), we'll probably need maintain more state to know what can be expunged. (And if we don't care about this, then might it be preferable to load all external data in parallel up front with the protocol, so there's only a single "protocol loaded" event as far as the user in concerned?) (5) Time-based cache expiry makes things interesting: data may change during an interview; if data is in redux, we can't caching selectors (at least with the default memoizers). Would an explicit 'clear cache' button in settings make for a more predictable UX? (6) Does data loading also respect whatever cache headers are set by the server (used by the browser)? |
I don't have any clear answers for this, but my understanding is we need to consider the following: It should support different sources:
It should support different types:
It may be utilised differently depending on the consumer:
The spec in the issue describes how this might look in the protocol config: but in reality that wouldn't include things like loading state or caching info. It might not even make sense to put this data into redux, maybe it would be preferable to cache to local files. Perhaps the implementation could be a HOC which manages fetching / streaming / holding the data in state - whatever makes most sense for achieving the above features. |
- Add a workerAgent to multiplex messages - Make the user functions ignorant of Worker boilerplate - Remove externalData for now; see #413 - Formally make Node a container; avoid sending label props through ancestors
Yes. The idea would be to have some form of templating system for use in the URL.
Sorry - this is me being lax with my language use. I think the data structure described in my post is what would be in the redux state. Up until now, we have directly embedded external data within
I am not sure what the repercussions of this would be, but the idea I had was to "load" (that is, read and parse) external data as it is requested by an interface. This would be similar to how the information interface loads media such as video or audio. We could also 'preload' (as discussed in #621), but might this have implications for RAM usage? Not sure - genuinely curious. The other consideration is that given that session data might be passed to the endpoint in the URL (see 1), some external data cannot be meaningfully resolved until a specific point in the interview.
The resolution to this depends to an extent on how we resolve 4. For example, if we load data at interview session start, we no longer need to track how stale the data is, or worry about it changing within the interview. The real reason I liked this, is that it would give the researcher some control over how often data is expected to meaningfully change. If it effectively needs to be fetched in response to interview session values, the cache property would seem to be redundant. Let's start by fetching data every time for now, and refine this as we go.
This was another thought I had while writing the above. Perhaps we can solve this problem at the server end, and use existing transport level mechanisms for cache. Something to consider. |
Two changes since this issue was opened:
For other parts of the app (e.g., selectors) to work seamlessly with external and new network data, we probably want to present the transformed data to a requesting component |
Per https://github.com/codaco/Network-Canvas/issues/718#issuecomment-438765777, when transposing, any variables with names that don't exist in the registry for the given [stage] subject should be ignored. |
This was implemented by @wwqrd in https://github.com/codaco/Network-Canvas/pull/840 Still left to do:
|
New approach for loading externalData
Questions
isLoading
andisLoaded
go? I copied the above from the protocol in redux.The text was updated successfully, but these errors were encountered: