1use crate::cli::{
2 BioAction, ChemAction, ClinicalAction, EconomicsAction, GeoAction, GeometricAction,
3 ScienceAction, ThermoAction,
4};
5use crate::science;
6
7pub fn handle(action: &ScienceAction) {
8 match action {
9 ScienceAction::Chem { action } => match action {
10 ChemAction::Smiles { smiles } => science::run_chem_smiles(smiles),
11 ChemAction::Thermo { reaction, a, b, c } => {
12 science::run_chem_thermo(reaction, *a, *b, *c)
13 }
14 ChemAction::DrugLike { smiles } => science::run_chem_druglike(smiles),
15 ChemAction::Pka {
16 pka,
17 conc_base,
18 conc_acid,
19 } => science::run_chem_pka(*pka, *conc_base, *conc_acid),
20 },
21 ScienceAction::Bio { action } => match action {
22 BioAction::Align {
23 query,
24 target,
25 mode,
26 } => science::run_bio_align(query, target, mode),
27 BioAction::Kmer { sequence, k } => science::run_bio_kmer(sequence, *k),
28 BioAction::Translate { dna } => science::run_bio_translate(dna),
29 BioAction::Isoelectric { protein } => science::run_bio_isoelectric(protein),
30 BioAction::Jaccard { sketch_a, sketch_b } => {
31 science::run_bio_jaccard(sketch_a, sketch_b)
32 }
33 BioAction::Minhash { sequence, k, size } => {
34 science::run_bio_minhash(sequence, *k, *size)
35 }
36 },
37 ScienceAction::Geo { action } => match action {
38 GeoAction::EmbedH3 { index } => science::run_geo_embed_h3(*index),
39 },
40 ScienceAction::Thermo { action } => match action {
41 ThermoAction::Gibbs {
42 enthalpy,
43 entropy,
44 temp,
45 } => science::run_thermo_gibbs(*enthalpy, *entropy, *temp),
46 ThermoAction::Anneal {
47 initial_temp,
48 particles,
49 proposed_energy,
50 random,
51 } => {
52 science::run_thermo_anneal(*initial_temp, *particles, *proposed_energy, *random);
53 }
54 },
55 ScienceAction::Geometric { action } => match action {
56 GeometricAction::Cross { a, b } => science::run_geometric_cross(a, b),
57 GeometricAction::Angle { a, b } => science::run_geometric_angle(a, b),
58 },
59 ScienceAction::Clinical { action } => match action {
60 ClinicalAction::Framingham {
61 age,
62 sex_male,
63 total_chol,
64 hdl_chol,
65 systolic_bp,
66 bp_treated,
67 smoker,
68 diabetic,
69 } => {
70 science::run_clinical_framingham(
71 *age,
72 *sex_male,
73 *total_chol,
74 *hdl_chol,
75 *systolic_bp,
76 *bp_treated,
77 *smoker,
78 *diabetic,
79 );
80 }
81 ClinicalAction::Sofa {
82 pao2_fio2,
83 platelets,
84 bilirubin,
85 map,
86 gcs,
87 creatinine,
88 } => {
89 science::run_clinical_sofa(
90 *pao2_fio2,
91 *platelets,
92 *bilirubin,
93 *map,
94 *gcs,
95 *creatinine,
96 );
97 }
98 ClinicalAction::Ckd {
99 age,
100 sex_male,
101 weight_kg,
102 creatinine,
103 } => {
104 science::run_clinical_ckd(*age, *sex_male, *weight_kg, *creatinine);
105 }
106 ClinicalAction::Pk {
107 dose_mg,
108 vd_l,
109 cl_l_hr,
110 time_hr,
111 } => {
112 science::run_clinical_pk(*dose_mg, *vd_l, *cl_l_hr, *time_hr);
113 }
114 ClinicalAction::DrugInteractions { drug_names } => {
115 science::run_clinical_drug_interactions(drug_names);
116 }
117 },
118 ScienceAction::Economics { action } => match action {
119 EconomicsAction::Gbm {
120 price,
121 drift,
122 vol,
123 horizon,
124 steps,
125 } => {
126 science::run_economics_gbm(*price, *drift, *vol, *horizon, *steps);
127 }
128 EconomicsAction::Var {
129 price,
130 drift,
131 vol,
132 horizon,
133 steps,
134 paths,
135 } => {
136 science::run_economics_var(*price, *drift, *vol, *horizon, *steps, *paths);
137 }
138 EconomicsAction::Macro {
139 m0,
140 p0,
141 velocity,
142 real_gdp,
143 horizon,
144 steps,
145 } => {
146 science::run_economics_macro(*m0, *p0, *velocity, *real_gdp, *horizon, *steps);
147 }
148 EconomicsAction::Bond {
149 face,
150 coupon_rate,
151 yield_rate,
152 periods,
153 } => {
154 science::run_economics_bond(*face, *coupon_rate, *yield_rate, *periods);
155 }
156 EconomicsAction::Paper { qty, last_price } => {
157 science::run_economics_paper(*qty, *last_price);
158 }
159 EconomicsAction::Welfare { incomes } => {
160 science::run_economics_welfare(&incomes);
161 }
162 EconomicsAction::Game { market_a } => {
163 science::run_economics_game(*market_a);
164 }
165 },
166 }
167}