API Documentation

Introduction

The API provided by cancerprediction.org allows HTTP POST requests of only one type: application/json.

Requests can be made using API platforms such as Postman or by creating an XMLHttpRequest (XHR), and should be directed to https://www.cancerprediction.org/api.

To make a successful API request, the 32 keys in the “Keys” section must be used in the given order. For “Values,” strings, floats, and integers are the only accepted types.

This API is useful for obtaining large quantities of predictions from cancerprediction.org’s machine learning model.

Keys

  1. age
  2. height1
  3. height2
  4. weight
  5. sex
  6. race7
  7. educat
  8. marital
  9. occupat
  10. cig_stat
  11. cig_years
  12. cigpd_f
  13. cigar
  14. pipe
  15. fh_cancer
  16. colo_fh
  17. colo_fh_cnt
  18. asppd
  19. ibuppd
  20. arthrit_f
  21. bronchit_f
  22. colon_comorbidity
  23. diabetes_f
  24. divertic_f
  25. emphys_f
  26. gallblad_f
  27. hearta_f
  28. hyperten_f
  29. liver_comorbidity
  30. osteopor_f
  31. polyps_f
  32. stroke_f

Values

Every key value must be convertible to either type int or float.

age (years):
Numeric

height1 (feet):
Numeric

height2 (inches):
Numeric

weight (pounds):
Numeric

sex:
1=“Male”
2=“Woman”

race7:
1=“White, Non-Hispanic”
2=“Black, Non-Hispanic”
3=“Hispanic”
4=“Asian”
5=“Pacific Islander”
6=“American Indian”
7=“Missing”

educat:
1=“Less Than 8 Years”
2=“8-11 Years”
3=“12 Years Or Completed High School”
4=“Post High School Training Other Than College”
5=“Some College”
6=“College Graduate”
7=“Postgraduate”

marital:
1=“Married Or Living As Married”
2=“Widowed”
3=“Divorced”
4=“Separated”
5=“Never Married”

occupat:
1=“Homemaker”
2=“Working”
3=“Unemployed”
4=“Retired”
5=“Extended Sick Leave”
6=“Disabled”
7=“Other”

cig_stat:
0=“Never Smoked Cigarettes”
1=“Current Cigarette Smoker”
2=“Former Cigarette Smoker”

cig_years:
0.5=“Six Months”

cigpd_f: “During periods when you smoked, how many cigarettes did or do you usually smoke per day?”

0=“0”
1=“1-10”
2=“11-20”
3=“21-30”
4=“31-40”
5=“41-60”
6=“61-80”
7=“81+”

cigar:
0=“Never”
1=“Current Cigar Smoker”
2=“Former Cigar Smoker”

pipe:
0=“Never”
1=“Current Pipe Smoker”
2=“Former Pipe Smoker”

fh_cancer: Any first-degree relative with cancer. Basal cell skin cancers are not included. First-degree relatives include parents, full-siblings, and children. Half-siblings are not included

0=“No”
1=“Yes”

colo_fh: Colorectal cancer family history in first-degree relatives. Includes parents, full-siblings, and children

0=“No”
1=“Yes, Immediate Family Member”
9=“Possibly - Relative Or Cancer Type Not Clear”

colo_fh_cnt: The number of first-degree relatives with colorectal cancer

Numeric

asppd: “During the last 12 months, how many pills of aspirin or aspirin containing products did you usually take per day, per week, or per month?”

0=“None”
1=“1/Day”
2=“2+/Day”
3=“1/Week”
4=“2/Week”
5=“3-4/Week”
6=“<2/Month”
7=“2-3/Month”

ibuppd: “During the last 12 months, have you regularly used ibuprofen-containing products, such as Advil, Nuprin, or Motrin?”

0=“None”
1=“1/Day”
2=“2+/Day”
3=“1/Week”
4=“2/Week”
5=“3-4/Week”
6=“<2/Month”
7=“2-3/Month”

The following diseases/events refer to keys #18 and onward in the “Keys” section. Depending on whether or not the disease/event occurred, the “Values” are:
0=“No”
1=“Yes”

Arthritis
Bronchitis
Colon Comorbidities
Diabetes
Diverticulitis/Diverticulosis
Emphysema
Gallbladder Stones or Inflammation
Heart Attack
Hypertension
Liver Comorbidities
Osteoporosis
Colorectal Polyps
Stroke

Examples

Using Postman

Postman Request Example

Note the mixed use of strings, floats, and integers.

Creating an XMLHttpRequest (XHR)

XHR Example

Payload must be of type JSON.