Skip to content

Commit

Permalink
refactor(cli): ♻️ generic update
Browse files Browse the repository at this point in the history
  • Loading branch information
keinsell committed Jun 15, 2024
1 parent d289daa commit 79f69d7
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 201 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

190 changes: 30 additions & 160 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions apps/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ libsqlite3-sys = { version = "*", features = ["bundled"] }
log = "0.4.21"
db = { path = "./../../db/rust-seaorm-client", package = "neuronek-database-client" }
rust-embed = "8.4.0"
sea-orm = { version = "0.12", features = ["sqlx-sqlite", "runtime-async-std-native-tls", "macros", "with-chrono", "with-json", "with-time", "with-time", "with-chrono", "with-json", "with-uuid", "with-rust_decimal", "with-bigdecimal"] }
sea-orm-migration = "^0.12.0"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = { version = "1.0.117", features = ["alloc", "preserve_order", "raw_value", "arbitrary_precision", "unbounded_depth"] }
structopt = { version = "0.3.26", features = ["suggestions", "color", "wrap_help"] }
Expand All @@ -44,6 +42,7 @@ dateless = "0.3.1"
iso8601-duration = { version = "0.2.0",features = ["serde", "chrono"] }
measurements = { version = "0.11.0",features = ["serde", "std", "from_str"] }
termimad = "0.29.2"
itertools = "0.13.0"

[features]
default = []
Expand Down
19 changes: 19 additions & 0 deletions apps/cli/src/cli/dashboard/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
// TODO: Get active ingestions along their progress
// TODO: Get analisis of side-effects and when they will likely occur

use itertools::Itertools;

use db::sea_orm::*;
use db::sea_orm::DatabaseConnection;

pub async fn handle_show_dashboard(database_connection: &DatabaseConnection) {
println!("Dashboard is not implemented yet.");

// Show average dosage per day of each substance that was ingested
let ingestions = db::ingestion::Entity::find().all(database_connection).await.unwrap();

// Group ingestions by substance name
let ingestions_by_substance = ingestions
.into_iter()
.chunk_by(|ingestion| ingestion.substance_name.as_ref().unwrap().clone()).into_iter();

println!("Ingestions by substance:");
}
Loading

0 comments on commit 79f69d7

Please sign in to comment.