helium / oracles

Oracles for Helium subDAOs
Apache License 2.0
17 stars 18 forks source link

Add `coverage_map` crate to provide `CoverageMapBuilder` and `CoverageMap` data structures #819

Closed maplant closed 1 month ago

maplant commented 1 month ago

What does this new crate provide?

What work is left to do in this crate?

This crate is basically complete, but the following work remains:

michaeldjeffrey commented 1 month ago

When there's a single radio covering 2 hexes, both hexes should come back with rank 1. Currently, they are ranked sequentially.

#[test]
    fn single_radio() {
        let mut indoor_coverage = IndoorCellTree::default();

        insert_indoor_coverage_object(
            &mut indoor_coverage,
            indoor_cbrs_coverage_with_loc(
                "1",
                Cell::from_raw(0x8c2681a3064d9ff).unwrap(),
                date(2022, 2, 2),
            ),
        );
        insert_indoor_coverage_object(
            &mut indoor_coverage,
            indoor_cbrs_coverage_with_loc(
                "1",
                Cell::from_raw(0x8c2681a3064dbff).unwrap(),
                date(2022, 2, 2),
            ),
        );

        let coverage = into_indoor_coverage_map(indoor_coverage, &NoBoostedHexes, Utc::now())
            .collect::<Vec<_>>();
        for ranked in coverage {
            println!("{ranked:?}");
        }
    }
maplant commented 1 month ago

When there's a single radio covering 2 hexes, both hexes should come back with rank 1. Currently, they are ranked sequentially.

#[test]
    fn single_radio() {
        let mut indoor_coverage = IndoorCellTree::default();

        insert_indoor_coverage_object(
            &mut indoor_coverage,
            indoor_cbrs_coverage_with_loc(
                "1",
                Cell::from_raw(0x8c2681a3064d9ff).unwrap(),
                date(2022, 2, 2),
            ),
        );
        insert_indoor_coverage_object(
            &mut indoor_coverage,
            indoor_cbrs_coverage_with_loc(
                "1",
                Cell::from_raw(0x8c2681a3064dbff).unwrap(),
                date(2022, 2, 2),
            ),
        );

        let coverage = into_indoor_coverage_map(indoor_coverage, &NoBoostedHexes, Utc::now())
            .collect::<Vec<_>>();
        for ranked in coverage {
            println!("{ranked:?}");
        }
    }

Fixed and added as test