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