aces / Loris

LORIS is a web-accessible database solution for longitudinal multi-site studies.
GNU General Public License v3.0
142 stars 172 forks source link

Add Subproject EndPoint to API #4222

Open thomasbeaudry opened 5 years ago

thomasbeaudry commented 5 years ago

Currently there doesn't exist a subproject endpoint for the API. My LORIS instance restricts access to data on the subproject level, so the normal project endpoint will return too much information. Essentially this new endpoint adds more granularity to the API to satisfy permissions.

The response format that I would envision would be:

Single Subproject

GET /projects/$ProjectName/$SubprojectName

Returns a 200 OK response if the project and subproject exist, and 404 Not Found if it does not (the same is true of any portion of the API under /projects/$ProjectName/$Subproject.)

The body of the request to /projects/$ProjectName/$SubprojectName will be an entity of the form:

{
    "Meta" : {
        "Project" : "ProjectName"
        "Subproject" : "SubprojectName"

    },
    "Visits" : ["V1", "V2", ... ],
    "Instruments" : ["InstrumentName", "InstrumentName2", ...],
    "Candidates" : ["123543", "523234", ...]
}

Single Subproject Instruments

GET /projects/$ProjectName/$SubprojectName/instruments/

Will return a JSON object of the form:

{
    "Meta" : {
        "Project" : "ProjectName"
        "Subproject" : "SubprojectName"
    },
    "Instruments": {
        "InstrumentName" : {
            "FullName" :  "Long Name",
            "Subgroup" : "Subgroup Name",
            "DoubleDataEntryEnabled" : boolean
        },
        "Instrument2" : {
            "FullName" :  "Long Name",
            "Subgroup" : "Subgroup Name",
            "DoubleDataEntryEnabled" : boolean
        },
        ...
    }
}

Single subproject images

GET /projects/$ProjectName/$Subproject/images/

Will return a JSON object of the form:

{
  "Images" : [
    {
      "Candidate": "123456",
      "PSCID": "MTL001",
      "Visit": "V1",
      "Visit_date": "2016-08-09", /* The date of the session. This will be null for phantoms and session that are not yet started */
      "Site": "Montreal Neurological Institute",
      "ScanType": "t2", /* Acquisition protocol */
      "QC_status": "Pass|Fail|null",
      "Selected": "true|false|null",
      "Link": "\/candidates\/300022\/V1\/images\/loris-MRI_123456_V1_t2_001.mnc", /* URL relative to this API */
      "InsertTime": "2016-08-09T14:15:30-05:00" /* The inserted date ISO 8601 */
    },
    ...
  ]
}

Single subproject visits

GET /projects/$ProjectName/$Subproject/visits/

Will return a JSON object of the form:

{
    "Meta" : {
        "Project" : "ProjectName"
        "Subproject" : "SubprojectName"
    },
    "Visits" : ["V1", "V2", ... ],
}

Single subproject candidates

GET /projects/$ProjectName/$Subproject/candidates/

will return a JSON object of the form:

{
    "Meta" : {
        "Project" : "ProjectName"
        "Subproject" : "SubprojectName"
    },
    "Candidates" : ["123456", "342332", ... ],
}

Also, as a side note, I think that if you wanted to omit the $ProjectName from the GET calls to shorten them, then you would need to do something like:

GET /subprojects/$Subproject

Thanks!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xlecours commented 1 year ago

There will be a endpoint for that. It will probably refer to cohorts instead of subprojects and it will probably be location at the root of our API.