Format and lint
This commit is contained in:
parent
42ee2d4c51
commit
04a78e7bfe
75 changed files with 1290 additions and 719 deletions
|
|
@ -14,44 +14,44 @@ use crate::state::AppState;
|
|||
|
||||
#[derive(Serialize)]
|
||||
pub struct HistogramStats {
|
||||
min: f64,
|
||||
max: f64,
|
||||
pub min: f64,
|
||||
pub max: f64,
|
||||
/// 1st percentile (left edge of main distribution)
|
||||
p1: f64,
|
||||
pub p1: f64,
|
||||
/// 99th percentile (right edge of main distribution)
|
||||
p99: f64,
|
||||
counts: Vec<u64>,
|
||||
pub p99: f64,
|
||||
pub counts: Vec<u64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct NumericFeatureStats {
|
||||
name: String,
|
||||
count: usize,
|
||||
min: f64,
|
||||
max: f64,
|
||||
mean: f64,
|
||||
histogram: HistogramStats,
|
||||
pub name: String,
|
||||
pub count: usize,
|
||||
pub min: f64,
|
||||
pub max: f64,
|
||||
pub mean: f64,
|
||||
pub histogram: HistogramStats,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct EnumFeatureStats {
|
||||
name: String,
|
||||
counts: HashMap<String, u64>,
|
||||
pub name: String,
|
||||
pub counts: HashMap<String, u64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct PricePoint {
|
||||
year: f32,
|
||||
price: f32,
|
||||
pub year: f32,
|
||||
pub price: f32,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct HexagonStatsResponse {
|
||||
count: usize,
|
||||
numeric_features: Vec<NumericFeatureStats>,
|
||||
enum_features: Vec<EnumFeatureStats>,
|
||||
pub count: usize,
|
||||
pub numeric_features: Vec<NumericFeatureStats>,
|
||||
pub enum_features: Vec<EnumFeatureStats>,
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
price_history: Vec<PricePoint>,
|
||||
pub price_history: Vec<PricePoint>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
@ -158,7 +158,10 @@ pub async fn get_hexagon_stats(
|
|||
|
||||
// Collect price history (year, price) pairs
|
||||
let price_history = {
|
||||
let year_idx = state.feature_name_to_index.get("Date of last transaction").copied();
|
||||
let year_idx = state
|
||||
.feature_name_to_index
|
||||
.get("Date of last transaction")
|
||||
.copied();
|
||||
let price_idx = state.feature_name_to_index.get("Last known price").copied();
|
||||
match (year_idx, price_idx) {
|
||||
(Some(yi), Some(pi)) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue