Skip to content

KitwareMedical/AllenInstituteMockLIMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Allen Institute Mock LIMS implementation

Tested on Python 3.8 with Flask 1.1.2

Getting Started

  1. Download source

    git clone https://github.com/KitwareMedical/AllenInstituteMockLIMS
    cd AllenInstituteMockLIMS
  2. Create virtual environment

    python3 -m venv venv
    . venv/bin/activate
  3. Install requirements

    pip install -r requirements.txt
  4. Start the flask application

    python -m flask run

Endpoints:

Fetch Specimen Metadata

GET /specimen_metadata/view

Returns json metadata of a specimen based on the kind of metadata.

Query Parameters

Parameter Type Description
specimen_id integer Unique id property of the Specimen entry in the LIMS that the metadata is associated with
kind string The kind of metadata that is to be retrieved (eg. "IVSCC cell locations")
version_number (opt.) integer The version of the metadata, which may be defined by the kind of metadata

Response

Success 200

{
  "version_number": 2,
  "data": {"foo": "bar"}
}

Error

Status Code Body
500 { "status": 500, "message": "Something went wrong" }
404 { "status": 404, "message": "Record not found" }
400 { "status": 400, "message": "Param foo is missing" }

Sample Call

Request:

GET /specimen_metadata/view?specimen_id=1234&kind=IVSCC%20cell%20locations

Response:

{
  "version_number": 2,
  "data": {"foo": "bar"}
}

Notes

If version_number is not specified, then the current version will be returned

Store Specimen Metadata

POST /specimen_metadata/store

Stores json metadata of a specimen based on the kind of metadata.

URL Params

None. If URL params are provided, the request will be rejected with code 400

POST body

Required:

Value Type Description
specimen_id integer Unique id property of the Specimen entry in the LIMS that the metadata is associated with
kind string The kind of metadata that is to be retrieved (eg. "IVSCC cell locations")
data object The metadata to be stored. This should be a vaid JSON object

Example Body:

{
    "specimen_id": 1234,
    "kind": "IVSCC cell locations",
    "data": {"foo": "bar"}
}

Headers

Header Value
Content-Type application/json

Response

Success 200

{
  "id": 1234,
  "version_number": 2
}

Error

Status Code Body
500 {"status": 500, "message": "Something went wrong"}
404 {"status": 404, "message": "Record not found"}
400 {"status": 400, "message": "Param foo is missing"}

Sample Call

Request:

POST /specimen_metadata/store

{
  "specimen_id": 1234,
  "kind": "IVSCC cell locations",
  "data": {"foo": "bar"}
}

Response:

{
  "id": 1234,
  "version_number": 2
}