OHDSI Home | Forums | Wiki | Github

New lightweight OHDSI REST API

I’m thinking of making one. Probably node.js. Something minimal (at least for now) to facilitate developing front-end proof-of-concept code without having to fit into WebAPI or ATLAS. If anyone would like to pitch in (coding or advice – or funding, though this shouldn’t take long to build), let me know. If I do get something together and it seems useful, I’ll ask for permission to add it as a new repo to the OHDSI collection.

1 Like

So, I don’t have funding for this, but I do think I will need some kind of api server for a funded project I’m working on (and maybe another). Without explicit funding for this or collaboration from others, it would be irresponsible of me to build any more than the minimum necessary to work on these projects (which don’t yet have an OHDSI WebAPI/ATLAS infrastructure in place, which is why I need something like this.)

However, as I start looking into the right way to go about this, I have a fantasy that it could eventually turn into a viable alternative to WebAPI. So I’m going to record some notes here about my thinking process, and, if you think it might be nice to someday have an alternative to WebAPI, I hope you’ll chime in with thoughts and advice.

I’m starting here https://github.com/marmelab/awesome-rest#nodejs for ideas of a platform to build a REST API on. I think Node.js is the way to go in terms of server language. That page led me to this helpful comparison: http://loopback.io/resources/#compare, and then I looked for some reviews: http://www.capitalone.io/blog/contrasting-enterprise-nodejs-frameworks/.

Is it possible that a REST server platform with good database support (and does that imply that it includes an ORM? I’m not sure) could help us solve some of the problems SQLRender was built to solve? Could it minimize the work involved in supporting the same API over multiple databases? I don’t know. But if so, it could it support all the ones we currently support plus Hadoop? That would be a big win. And what about Google BigQuery (which is the database platform for the funded project I’m working on, which is why I can’t currently rely on WebAPI?

If the WebAPI alternative idea is a non-starter, maybe I should just pick the simplest thing that will support either Postgres or BigQuery (if BigQuery, then no one will be likely to use it except my current client), probably http://postgrest.com/ (the video on that page has some good general comments about what a database rest api should do.) But if I want other people to be able to use this (which might be nice even if it doesn’t become an alternative to WebAPI), I should pick something that supports multiple databases.

Unfortunately I haven’t used any of these, but at first glance the best candidates look like http://sailsjs.org/ and http://loopback.io/. Sails seems to have a bigger user base, but Loopback says it has ACLs and authentication/authorization support and it has IBM backing which might be important to @Gowtham_Rao and maybe others.

So I’ll take my first stab with Loopback and report back later.

what about REST API for any Postgres database http://postgrest.com
it is simple and ellegant

Yeah, that’s the one I’m going to use if I decide it’s ok to only support Postgres. I’m sure it would be easier to deal with than Loopback, which I’m trying now. Thanks!

So, I’ve started playing with Loopback and am quite encouraged so far. I set up a postgres connection easily and used the model discovery feature to have it automatically create model files for a couple tables (drug_exposure and person). As soon as that was done, there were automatically api calls available for all the CRUD features (which we don’t need, of course), but also for querying. For instance: http://0.0.0.0:3000/api/People?filter[where][personId][lt]=10 gives me the first 9 people in the person table (it apparently already knew that the plural of person is people, so that’s the name of the api call.)

There an api explorer tool making it easy to figure out what api calls are available and what their syntax is.

I’m impressed. This is clearly going to make it easy for me to make whatever api calls I need for front-end development.

t