MohamedTry commited on
Commit
9cec003
·
verified ·
1 Parent(s): 66b72b9

Update ajcc_api.py

Browse files
Files changed (1) hide show
  1. ajcc_api.py +33 -24
ajcc_api.py CHANGED
@@ -54,31 +54,40 @@ def stage_cancer(cancer_type: str, T: str, N: str, M: str) -> str:
54
  N = normalize_tnm(N)
55
  M = normalize_tnm(M)
56
 
57
- match cancer_type:
58
- case "breast":
59
- return stage_breast(T, N, M)
60
- case "lung" | "nsclc" | "non-small cell lung" | "non small cell lung":
61
- return stage_nsclc(T, N, M)
62
- case "colon" | "rectal" | "colorectal":
63
- return stage_colorectal(T, N, M)
64
- case "stomach" | "gastric":
65
- return stage_stomach(T, N, M)
66
- case "pancreas" | "pancreatic":
67
- return stage_pancreas(T, N, M)
68
- case "liver" | "hcc" | "hepatocellular":
69
- return stage_liver(T, N, M)
70
- case "melanoma":
71
- return stage_melanoma(T, N, M)
72
- case "prostate":
73
- return stage_prostate(T, N, M)
74
- case "kidney" | "renal":
75
- return stage_kidney(T, N, M)
76
- case "bladder":
77
- return stage_bladder(T, N, M)
78
- case _:
79
- # General fallback AJCC rule
80
- return stage_general(T, N, M)
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  # ---------------------------------------------------------------------
84
  # General fallback AJCC rule (for unknown cancer types)
 
54
  N = normalize_tnm(N)
55
  M = normalize_tnm(M)
56
 
57
+ if cancer_type == "breast":
58
+ return stage_breast(T, N, M)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ elif cancer_type in ("lung", "nsclc", "non-small cell lung", "non small cell lung"):
61
+ return stage_nsclc(T, N, M)
62
+
63
+ elif cancer_type in ("colon", "rectal", "colorectal"):
64
+ return stage_colorectal(T, N, M)
65
+
66
+ elif cancer_type in ("stomach", "gastric"):
67
+ return stage_stomach(T, N, M)
68
+
69
+ elif cancer_type in ("pancreas", "pancreatic"):
70
+ return stage_pancreas(T, N, M)
71
+
72
+ elif cancer_type in ("liver", "hcc", "hepatocellular"):
73
+ return stage_liver(T, N, M)
74
+
75
+ elif cancer_type == "melanoma":
76
+ return stage_melanoma(T, N, M)
77
+
78
+ elif cancer_type == "prostate":
79
+ return stage_prostate(T, N, M)
80
+
81
+ elif cancer_type in ("kidney", "renal"):
82
+ return stage_kidney(T, N, M)
83
+
84
+ elif cancer_type == "bladder":
85
+ return stage_bladder(T, N, M)
86
+
87
+ else:
88
+ return stage_general(T, N, M)
89
+
90
+
91
 
92
  # ---------------------------------------------------------------------
93
  # General fallback AJCC rule (for unknown cancer types)