Comments (1)
After pondering this for a while and playing with various options, here's what I suggest. We can support two modes, a synchronous mode where the final answer is transmitted as one object when everything is ready. This is the traditional way of doing things. For your example query above, it might look like this:
{
"query": "/psms?resultType=compact&accession=PXD005942"
"responses": [
{
"source": "PeptideAtlas",
"code": 200
"elapsed_seconds": 5.2322
"psms": [
{
"peptideSequence": "LSSPATLNSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:10:LSSPATLNSR/2",
},
{
"peptideSequence": "APLVCLPVFVSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:120:APLVC[Carbamidomethyl]LPVFVSR/2",
}
]
},
{
"source": "PRIDE":
"code": 200,
"elapsed_seconds": 1.3243
"psms": [
{
"peptideSequence": "LSSPATLNSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:10:LSSPATLNSR/2",
}
]
},
{
"source": "MassIVE"
"code": 404,
"elapsed_seconds": 0.2342
"message": "PSMs for PXD005942 not available"
},
{
"source": "jPOST"
"code": 0,
"message": "Timed out after 30 seconds"
"elapsed_seconds": 30.0000
}
]
}
This would not arrive until 30 seconds (the timeout) has elapsed but the returned result is a single JSON object.
The second, fancy way is to stream objects as they become available with a special final object to signal that the stream is done. this might be:
{
"source": "MassIVE"
"code": 404,
"elapsed_seconds": 0.2342
"message": "PSMs for PXD005942 not available"
}
{
"source": "PRIDE"
"code": 200,
"elapsed_seconds": 1.3243
"psms": [
{
"peptideSequence": "LSSPATLNSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:10:LSSPATLNSR/2",
}
]
}
{
"source": "PeptideAtlas",
"code": 200,
"elapsed_seconds": 5.2322
"psms": [
{
"peptideSequence": "LSSPATLNSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:10:LSSPATLNSR/2",
},
{
"peptideSequence": "APLVCLPVFVSR",
"usi": "mzspec:PXD005942:030219_ywt_sf-39:scan:120:APLVC[Carbamidomethyl]LPVFVSR/2",
}
]
}
{
"responses": {
"PeptideAtlas": {
"code": 200,
"elapsed_seconds": 5.2322
},
"PRIDE": {
"code": 200,
"elapsed_seconds": 1.3243
}
"MassIVE": {
"code": 404,
"message": "PSMs for PXD005942 not available"
"elapsed_seconds": 0.2342
}
"jPOST": {
"code": 0,
"message": "Timed out after 30 seconds"
"elapsed_seconds": 30.0000
}
}
}
The objects are transmitted as they become available. Unlike the way they are depicted above, objects do not contain newlines, but are separated by newlines. If an object contains "source" then it is a new transmitted result. If the object contains "responses" then the client knows that that is the final object and it can stop reading from the stream. This allows the first results to be available in seconds with late results trickling in later. This latter model is what we currently use for this page:
http://proteomecentral.proteomexchange.org/PROXI.php
to pleasing effect. You can see the raw stream that the client uses here:
http://proteomecentral.proteomexchange.org/cgi/PROXI_status
The client chooses which model they want to use: complete response or streamed objects. either way, the responses from each source are the same and can be accessed with the same code. The content of "psms" is what we current return with /psms
The only snag is that this model vastly different than the current /psms. I wanted them to be the same.
To make them compatible, we'd need to think about this some more, but I'm out of time for now..
from proxi-schemas.
Related Issues (20)
- do we really stipulate a max pageSize? HOT 1
- Massive data files do not exist
- /peptidoforms still labeled getPeptides
- inconsistent count* in Peptidoform
- What should the compact form of /peptidoforms return? HOT 2
- Add 500 to the list?
- msrun and filename HOT 8
- species as query parameter? HOT 2
- Error status should contain only error code HOT 1
- In the PSM object the score should be plural HOT 7
- Develop JSON Schema validator HOT 3
- PRIDE PROXI spectra returning mzs not in order HOT 3
- PRIDE USI without interpretation not working? HOT 1
- No attributes for spectra at PRIDE? HOT 2
- How should a spectrum status be used? HOT 2
- update specification and schemas
- Validator of the PROXI APIs implementations
- Improve documentation of the entry points in the swagger.yaml file
- Precursor m/z
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxi-schemas.