Skip to content

A Containerized KinderMiner / Serial KinderMiner Server

License

Notifications You must be signed in to change notification settings

stewart-lab/fast_km

Folders and files

NameName
Last commit message
Last commit date

Latest commit

xuanchengtuXuancheng Turmillikin
Jan 4, 2023
bcb1cc5 · Jan 4, 2023

History

96 Commits
Apr 18, 2022
Jan 4, 2023
Feb 14, 2022
Sep 21, 2022
Sep 21, 2022
Oct 4, 2021
Feb 14, 2022
Mar 29, 2022
Nov 7, 2022
Jan 4, 2023
Nov 7, 2022

Repository files navigation

fast_km

API

/skim/api/jobs/

POST:

Post a SKiM job to the job queue. Must be in json format. Returns the job ID. Parameters: A dictionaries with the keys:

  • "a_terms": list of strings
  • "b_terms": list of strings
  • "c_terms": list of strings
  • "top_n": integer
  • "ab_fet_threshold": float
  • "censor_year" (optional): integer
  • "return_pmids" (optional): boolean

Example:

import requests
post_json = { "a_terms": ["cancer"], "b_terms": ["tumor"], "c_terms": ["skin"], "top_n": 50, "ab_fet_threshold": 0.01 }
response = requests.post('http://localhost:5000/skim/api/jobs', json=post_json).json()
job_id = response['id']

Response:

{ 
  'id': 'abcd', 
  'status': 'submitted' 
}

GET:

Returns the job's status given its ID, and, if the job is finished, the results of the job.

A finished job contains in the 'results' key a list of dictionaries, each with the key:

  • "a_term": string
  • "b_term": string
  • "c_term": string
  • "ab_pvalue": float
  • "ab_sort_ratio": float
  • "ab_pred_score": float
  • "bc_pvalue": float
  • "bc_sort_ratio": float
  • "bc_pred_score": float
  • "a_count": integer
  • "b_count": integer
  • "c_count": integer
  • "ab_count": integer
  • "bc_count": integer
  • "total_count": integer
  • "ab_pmid_intersection": set of integers, cast as a string
  • "bc_pmid_intersection": set of integers, cast as a string

Example:

import requests
get_response = requests.get("http://localhost:5000/skim/api/jobs?id=" + job_id).json()
job_status = get_response['status']
if job_status == 'finished':
  job_result = get_response['result']

Response:

{ 
  'id': 'abcd', 
  'status': 'finished', 
  'result': [{ "a_term": "cancer", "b_term": "tumor", ... }] 
}