Skip to content
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

new feature: return all intermines over version x #130

Open
yochannah opened this issue Aug 9, 2019 · 3 comments
Open

new feature: return all intermines over version x #130

yochannah opened this issue Aug 9, 2019 · 3 comments

Comments

@yochannah
Copy link
Member

Sometimes applications need to fetch all InterMines, but only above (or below) a certain version, to avoid calling features that don't exist, or to take advantage of newer features. IT would be nice to ask the registry to only return InterMines of the version we want.

A useful API call to the registry might look something like this:

http://registry.intermine.org/service/instances?version_api=gte-25
http://registry.intermine.org/service/instances?version_api=lt-24
http://registry.intermine.org/service/instances?version_api=eq-24

http://registry.intermine.org/service/instances?version_intermine=gte-2.0.0
http://registry.intermine.org/service/instances?version_intermine=lt-1.6.6
http://registry.intermine.org/service/instances?version_intermine=eq-4.0.0

the operators I've suggested above are:


gt (greater than)
gte (greater than or equal to)
lt (less than)
lte (less than or equal to)
eq (equal to)

Additionally, note that there are several different version strings returned by InterMines. Visit http://iodocs.apps.intermine.org and look at flymine, then search for the version endpoint. Here's a quick summary:

GET /version returns the API version. This is a int.
GET /version/release returns the version of the data release for that InterMine (and will be a string with arbitrary content)
GET /version/intermine returns the version of InterMine (as in the Java application). This looks like a number but is a string in semantic versioning format, e.g. "4.0.0".

/version/release and /version/intermine are newer endpoints, and older InterMines, such as Indigo, won't respond to them correctly - they'll return the int response, same as /version does. See http://www.cbrc.kaust.edu.sa/indigo/service/version/intermine for an example. Checking the response data type will give you an hint about which InterMines this happens in.

FINAL note - we should probably sort on API version and InterMine version, but the release version endpoint, given that it's arbitrary string data, won't be sortable, so it wouldn't make sense to have a filter for it.

@awasthishubh
Copy link

I would like to take this. :)
Few doubts/suggestions:

  • What should we do with those whose API_version or InterMine_version is not defined?
    A good solution I can think of is to add another parameter misc: true||false to let them choose whether to show or not.
  • We can also support for
    • ^ and ~ to match exact major with different patch/minor update (as used by npm)
    • version1-version2 to match in range. Not sure it's reasonable to query intermines in this way.
  • Is it guaranteed that the API_version and InterMine_version (if available) will be in the format x.x.x only ?

@zrthxn
Copy link

zrthxn commented Mar 30, 2021

Hi there @yochannah
If I have understood your description correctly, this can be done by filtering for the appropriate version for API and Intermine versions in this route.

router.get('/', function(req, res, next) {
let db_query = {};
if (req.query.q){
let query = req.query.q;
db_query = {
$or: [
{organisms: { $in: [query] }},
{$text: {$search: query}},
{name: {$regex: query, $options: "i"}}
]
}
}
if (req.query.mines){
let productionParam = req.query.mines;
if (productionParam === "dev"){
db_query.isProduction = false;
} else if (productionParam === "prod") {
db_query.isProduction = true;
}
} else {
db_query.isProduction = true;
}
// Just get the instances that are running
db_query.status = "Running";
// Exec query
Instance.find(db_query).sort({name: 1}).exec(function(err, instances){
if (err){
return res.send(err);
}
// Build the API response
let api_response = {};
api_response.instances = instances
api_response.statusCode = 200;
api_response.executionTime = new Date().toLocaleString();
res.status(api_response.statusCode).json(api_response);
});
});

And the release date param can probably be ignored since, like you said, it's arbitrary string data and it doesn't make sense to sort by the release date? (or maybe not?)

I can try some solutions out and see what works best. I'll just need to know how to connect the registry to an existing database.

@yochannah
Copy link
Member Author

hey @zrthxn - I've moved on from the InterMine team now. Paging @danielabutano or @uosl who I believe are still on the team and might be able to answer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants