Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Spatiotemporal Epidemiological Modeler (STEM) » Web interface?
Web interface? [message #562680] Fri, 19 March 2010 14:16 Go to next message
Doug  is currently offline Doug Friend
Messages: 30
Registered: March 2010
Member
I downloaded and have been getting familiar with creating diseases/infectors/inoculators/models/scenarios/triggers/... I am interested in integrating STEM into a web project - are existing projects/plugins working in that area?

At first I would like to just allow users to be able to run scenarios on a remote server through a web interface, and eventually would like to expose portions of the UI to allow them to modify runs by adding modifiers/triggers/inoculators...

I don't want to repeat effort so if there are existing projects, or anyone could point to where would be the best place to hook into STEM, I'd appreciate it. I am grabbing the source at the moment. Even a command-line execution format to pick the scenario to run would be a useful start, but I couldn't find any info about a command line execution.

Thanks,
Doug
Re: Web interface? [message #562706 is a reply to message #562680] Fri, 19 March 2010 16:17 Go to previous messageGo to next message
Matthew DavisFriend
Messages: 269
Registered: July 2009
Senior Member
Hi Doug,

We have some internal work on a Web-based STEM interface, but it's not really in a condition for public release at this time. It's really more of a proof-of-concept/what we can do. Right now, it's just a collection of JSON-generating servlets with a Dojo interface and visualizer built with Google Maps. Simulation controls are mainly related to state (start, stop, etc). The underlying container is running Jetty as an Eclipse plug-in. See: http://www.eclipse.org/equinox/server/

As for the hooks to control STEM through an API, my recommendation is that you start by looking at the SimulationManager and Simulation classes in in the org.eclipse.stem.jobs plug-in.

To initialize and run a headless simulation, pulling from our Web code, here's a very simple set of steps. Obviously any real system will be more advanced, but this is a basic startup. Note that the project name and scenario name correspond to projects and scenarios you created using the STEM UI.

import org.eclipse.emf.common.util.URI;
import org.eclipse.stem.core.Utility;
import org.eclipse.stem.core.scenario.Scenario;
import org.eclipse.stem.jobs.simulation.SimulationManager;
import org.eclipse.stem.jobs.simulation.ISimulation;
import org.eclipse.stem.jobs.simulation.Simulation;
...
String projectName = "somestemproject";
String scenarioName = "somescenarioname.scenario";

// Get the internal URI to the Scenario resource file in the workspace
URI scenarioUri = URI.createURI("platform:/resource/"+ projectName +"/scenarios/"+ scenarioName);
// Load the scenario from file
Scenario scenario = (Scenario)Utility.getIdentifiable(scenarioUri);
// Get the simulation manager
SimulationManager mgr = SimulationManager.getManager();
// Create a runnable simulation from the given scenario
ISimulation sim = mgr.createSimulation(scenario);
// Run the simulation
mgr.runSimulation(sim);
Re: Web interface? [message #562729 is a reply to message #562706] Mon, 22 March 2010 11:45 Go to previous messageGo to next message
Doug  is currently offline Doug Friend
Messages: 30
Registered: March 2010
Member
Thanks for the pointers!
Re: Web interface? [message #562964 is a reply to message #562729] Tue, 30 March 2010 13:51 Go to previous messageGo to next message
Doug  is currently offline Doug Friend
Messages: 30
Registered: March 2010
Member
By the way, is there any planned timeframe for when pieces of the web interface will be available?
Re: Web interface? [message #563107 is a reply to message #562706] Tue, 06 April 2010 21:41 Go to previous message
Doug  is currently offline Doug Friend
Messages: 30
Registered: March 2010
Member
I am still having trouble with this... I have what are probably lots of very basic questions. I have very limited time available to try to learn Eclipse and STEM, so perhaps this just isn't going to work out right now.

To simplify, I dropped the web app part for now and just want to create a standalone, command line version of STEM where parameters can be passed to specify the scenario, for example. I started with the code from Matt above, but swapped the last 4 lines for:

// Create a runnable simulation from the given scenario and run it
mgr.createAndRunSimulation(scenario);

(the version above was causing errors, but I don't recall what off the top of my head)

I assume I want to develop my command line driver as a plug-in, then set up a product configuration to export it as a standalone Eclipse application (I still can't seem to get that working for STEM itself, per http://www.eclipse.org/forums/index.php?t=msg&th=165083& amp;start=0&).

I have scenarios created from the version of STEM I downloaded, but can't seem to load them. Where would I need to copy/import/??? my "US-Flu" project in order to load its "test.scenario"?

If I run as a Java application, my working directory = C:\Documents and Settings\drafalsk\workspace\headlessSTEM, and
scenarioUri.toString() = platform:/resource/US-Flu/scenarios/test.scenario
scenarioUri.toFileString() = null

The code
Scenario scenario = (Scenario)Utility.getIdentifiable(scenarioUri);

Then fails withQuote:
> The serialized instance of an Identifiable at "platform:/resource/USFlu/scenarios/test.scenario" was not found or was of the wrong format
Previous Topic:Japanese STEM tutorial now available on YouTube
Next Topic:Build from Source Qs
Goto Forum:
  


Current Time: Fri Mar 29 15:22:30 GMT 2024

Powered by FUDForum. Page generated in 0.02823 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top