Tonight
This commit is contained in:
parent
28323f145e
commit
94f9c0d594
76 changed files with 3238 additions and 1230 deletions
|
|
@ -513,6 +513,8 @@ pub struct PropertyData {
|
|||
/// Per-feature: max - min (for encoding filter bounds).
|
||||
quant_range: Vec<f32>,
|
||||
pub feature_stats: Vec<FeatureStats>,
|
||||
/// Unquantized last sale price used by the price-history chart.
|
||||
last_known_price_raw: Vec<f32>,
|
||||
/// Contiguous buffer holding all address strings end-to-end.
|
||||
address_buffer: String,
|
||||
/// Byte offset into `address_buffer` where each row's address starts.
|
||||
|
|
@ -754,6 +756,12 @@ impl PropertyData {
|
|||
self.price_qualifier.get(&(row as u32)).map(String::as_str)
|
||||
}
|
||||
|
||||
/// Get the unquantized last sale price for charting.
|
||||
#[inline]
|
||||
pub fn last_known_price_raw(&self, row: usize) -> f32 {
|
||||
self.last_known_price_raw[row]
|
||||
}
|
||||
|
||||
/// Decode a single feature value from quantized u16 storage.
|
||||
#[inline]
|
||||
pub fn get_feature(&self, row: usize, feat_idx: usize) -> f32 {
|
||||
|
|
@ -1476,6 +1484,15 @@ impl PropertyData {
|
|||
.iter()
|
||||
.map(|&perm_index| lon[perm_index as usize])
|
||||
.collect();
|
||||
let last_known_price_raw: Vec<f32> = numeric_names
|
||||
.iter()
|
||||
.position(|&name| name == "Last known price")
|
||||
.map(|price_idx| {
|
||||
perm.iter()
|
||||
.map(|&perm_index| numeric_col_major[price_idx][perm_index as usize])
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_else(|| vec![f32::NAN; row_count]);
|
||||
|
||||
// Build contiguous address buffer and address search index (permuted)
|
||||
tracing::info!("Building interned strings");
|
||||
|
|
@ -1679,6 +1696,7 @@ impl PropertyData {
|
|||
quant_min,
|
||||
quant_range,
|
||||
feature_stats,
|
||||
last_known_price_raw,
|
||||
address_buffer,
|
||||
address_offsets,
|
||||
address_lengths,
|
||||
|
|
@ -1907,6 +1925,16 @@ mod tests {
|
|||
assert!(stats.slider_max < 1000.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fixed_price_bounds_keep_slider_cap() {
|
||||
let data = vec![400_000.0_f32, 2_500_000.0, 3_750_000.0];
|
||||
let bounds = make_fixed_bounds(0.0, 2_500_000.0);
|
||||
let stats = compute_feature_stats(&data, &bounds, false);
|
||||
|
||||
assert_eq!(stats.slider_min, 0.0);
|
||||
assert_eq!(stats.slider_max, 2_500_000.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn histogram_bin_for_value() {
|
||||
let hist = Histogram {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue