openworm / org.geppetto

Geppetto is an open-source platform to build web-based applications to visualize and simulate neuroscience data and models.
http://geppetto.org
Other
209 stars 50 forks source link

Add ability to lazy load a value (Frontend) #500

Closed tarelli closed 8 years ago

tarelli commented 8 years ago

With @niteshthali08 we are looking at extending the support for NWB files. Given the size of the time series that are connected to an NWB file a functionality that would allow to lazy load them is desirable. This would work in the same way as resolveImportTypes with a symmetrical method resolveImportValue. Design proposal for this

cc @gidili what do you think?

tarelli commented 8 years ago

Pointers

Backend:

To change the ecore: https://github.com/openworm/org.geppetto.model/blob/master/src/main/resources/geppettoModel.ecore Ask @tarelli to regenerate the model and other help

https://github.com/openworm/org.geppetto.frontend/blob/da2f2ac62f124325010a1e95700575f056ef3cb5/src/main/java/org/geppetto/frontend/controllers/ConnectionHandler.java https://github.com/openworm/org.geppetto.simulation/blob/969d256dca87638007f08f3c899b99c573a7ec78/src/main/java/org/geppetto/simulation/manager/GeppettoManager.java https://github.com/openworm/org.geppetto.simulation/blob/969d256dca87638007f08f3c899b99c573a7ec78/src/main/java/org/geppetto/simulation/manager/RuntimeProject.java https://github.com/openworm/org.geppetto.simulation/blob/969d256dca87638007f08f3c899b99c573a7ec78/src/main/java/org/geppetto/simulation/visitor/ImportTypesVisitor.java

Frontend:

https://github.com/openworm/org.geppetto.frontend/blob/cf45c14b9372df52a74103528fc73c900d604924/src/main/webapp/js/websocket-handlers/GEPPETTO.SimulationHandler.js -> Makes a call to the server, arrives to WebsocketConnection and then to ConnectionHandler https://github.com/openworm/org.geppetto.frontend/blob/da2f2ac62f124325010a1e95700575f056ef3cb5/src/main/webapp/js/model/ModelFactory.js -> In charge of creating the ImportType currently and any other frontend wrapper. Ask @gidili for directions at the geppetto meeting if you get lost :)

https://github.com/openworm/org.geppetto.frontend/blob/development/src/main/webapp/js/model/ImportType.js -> We'll need ImportValue.js which wraps an ImportValue

tarelli commented 8 years ago

@niteshthali08 to create an ImportValue in the ecore choose new EClass, make ImportValue extend Value (check how ImportType extends Type) screen shot 2016-05-26 at 20 15 01

tarelli commented 8 years ago

@niteshthali08 https://github.com/tarelli/org.geppetto.docs/blob/master/source/geppettomodel.rst Model documentation

LordKrabo commented 8 years ago

@niteshthali08 @tarelli Add to sprint 74 or 75?

LordKrabo commented 8 years ago

Now added to Sprint 76.

LordKrabo commented 8 years ago

Took some of this and added it to #504 Add ability to lazy load a value backend.

niteshthali08 commented 8 years ago

@tarelli @gidili : I was just going through object returned by mergeModel method and found that diffReport captures the type for which synched was set as false. Now this type contains the variable in which I am interested. This variable also has correct initialValue which is timeseries sent by the server. I can find this details in the diffReport object at "types->compositeType ->wrappedObj->variables[0]->recording->initialValues->value->timeseries". Now having this information can't we just create required instance without writing new merge method?

gidili commented 8 years ago

hi @niteshthali08 - technically you are not creating an instance, as in not using the Instance.js object, because you are simply taking the json for the initial value in the diffReport (or is it the diffModel, I think diffReport is populated after mergeModel runs) for the variable you are interested in and swapping it in the appropriate wrapped object in THE model (Model.yourlibrary.yourtype.yourvariable.getWrappedObj) that did not have iniitial values to begin with. So yes, that's pretty much all this 'mergeValue' method we talked about will do!

So recap:

The reason why we suggested you do a mergeValue method is because traversing the model to find the right variable is similar to what happens in the mergeModel method, but I can think of a shortcut for this scenario where you could take the path of the variable that comes from the server and simply find the variable you want in the model by an eval on that "almost same" path...

Give it a shot, it seems like you're almost there!