Using engine in the web

Hi there.

First, thanks for this engine, it's a "monster"! It's really awesome.

I'm working on a project where i'm developing a web app, which later I would connect with your engine to get more accurate results.

BioGears would have to be running on a AWS Instance, which then I would have to connect with my Web app.

Though, I've been reading and searching around, and I can't find a way to do that connection. Not an API or anything like that

Any clue of how can I do it?

Thanks

Comments

  • abrayabray Entry Level
    edited September 2017
    [Deleted by moderator due to violating posting rules]
  • Hi Cafn!

    Thanks for your post.

    We don’t support any explicit API’s for web development with BioGears. There are a few ways you could go about doing this.

    Once your EC2 instance is spun up you’ll need to be able to run the engine on it. This could be done by pulling the latest code https://github.com/BioGearsEngine/Engine and installing java and ant. Then run the following ant targets from the src directory:

    cmake clean compile

    This will make and compile the code base for you and create the appropriate binaries.

    Now with the engine installed you’ll need to put some kind of web endpoint in front of it for your client to call. This could be done with a lightweight python or nodejs server using something like express js, flask, Django or something similar.

    To run a scenario you could have your client post to the web server the scenario info, have the server make an xml scenario file (or use an existing one) from the posted data and then run the scenario with a subprocess call. You’ll probably want to make this an asynchronous call or push it into a task queue (maybe something like celery http://www.celeryproject.org/) and return the run id for you to be able to monitor the progress.

    Once the simulation is running on the server you can monitor the progress with another endpoint that sends data back from the engine output file (using the run id you received when you started the run). You may want light weight data files so setting at the top of your scenario file will limit the amount of data written and thus transferred to the client. Another way you could monitor engine progress is by creating a web socket connection that will allow your client to subscribe to a publisher on the server for that task. This is up to you but web sockets may require more effort/money to work properly.

    You don’t need a docker container to run biogears although we do have plans in the future to build an image with the biogears engine in it and put it on docker hub so be sure to keep up to date with our latest development! Also, there have been some ideas floated around to create a javascript API but nothing concrete yet….

    Hopefully this helps and hopefully future development of BioGears over the next few years facilitates this integration a little more "cleanly"

    Austin Baird
    BioGears PI
Sign In or Register to comment.