Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposure Notification API #89

Open
adamfowleruk opened this issue Jun 2, 2021 · 3 comments
Open

Exposure Notification API #89

adamfowleruk opened this issue Jun 2, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@adamfowleruk
Copy link
Contributor

Built on top of the Analysis API, in order to provide and hit thresholds, and perform some action on hitting them.

@adamfowleruk adamfowleruk added the enhancement New feature or request label Jun 2, 2021
@adamfowleruk adamfowleruk self-assigned this Aug 28, 2021
@adamfowleruk
Copy link
Contributor Author

adamfowleruk commented Oct 16, 2021

Implement Risk Scoring

  • Provide aggregation of a SampleList by a time interval (1 Day by default)
  • Maintain a History of these Risk aggregates by date
  • Allow retrieval of risk aggregates by date
  • Allow merging of multiple risk aggregate details (E.g. one local, one from a remote paired device)
  • Allow a Risk summary to execute over these histories as they are updated
  • Link a Risk Summary calculator to a particular Disease
  • A Risk Summary calculator could have one or more named Diseases associated with them
  • Provide a Risk score updated callback
  • Provide the ability to save risk scores to disk, and read them again later

Implement Exposure Notification

  • For each disease, provide a set of risk score thresholds, and callbacks for increasedTo and decreasedTo
  • Ensure callbacks are not fired whilst history merging events are happening
  • Allow specification of rules such that the status cannot downgrade until a particular date time (prevents multiple notifications per day)
  • For each threshold, link the level to a description, summary, and current advice summary text and URLs
  • Ensure multiple languages are supported, with a set of language defaults
  • Allow these thresholds for different diseases to share the same impact score, so a person's advisories can be aggregated across diseases/strains

adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Oct 17, 2021
Added some EN functionality
- Specify multiple Agents(Diseases), levels, notification criteria, callbacks
- Link to analysis API with straightforward mechanism
- Variety of tests added via TDD and all passing
- Existing tests still passing
- Tested on Windows only
Signed-off-by: Adam Fowler <adam@adamfowler.org>
@adamfowleruk
Copy link
Contributor Author

adamfowleruk commented Oct 17, 2021

Need to split the current ExposureManager into ExposureRecorder (live RSSIMinute data for 'today') and ExposureStatusManager for confirming exposure sources (SampleIDs) as ill or not, and calculating the aggregated risk score for each source, and then calling the ExposureManager with updates for the risk score for each Agent(Disease). At the moment we're assuming everyone encountered is ill!

adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Oct 17, 2021
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 13, 2021
…nssl sha256.

Part of theheraldproject#89.
 - Refactoring Exposure API
 - Added base Exposure tests and implementation class
- Added outline for risk and exposure managers
- Added OpenSSL v3.1 (Apache-2.0) SHA256 support for non Windows/Mac/Zephyr platforms (linked statically)
- Fixed build and tests for linux 64 bit g++
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 13, 2021
Allows SHA256 to be built on Mac OS
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 13, 2021
…s added.

Part of theheraldproject#89
- Added RiskScore and RiskScoreMetadata types
- Separated ExposureMetadata from Exposure
- Added Score as a common data class for Exposure and RiskScore
- Added TaggedArray to allocatable_array file for an array with a tagged metadata value
- Used TaggedArray for a list of Exposures linked to one piece of metadata
- Used TaggedArray for a list of RiskScores linked to one piece of RiskScoreMetadata
- All tests still pass, some new tests added
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 13, 2021
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 13, 2021
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 15, 2021
Various Exposure and RiskScore imnprovements
- Ensured all methods and lines covered in tests
- Ensured compilation, tests, and coverage works on both gcc and clang on linux x86_64
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 27, 2021
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 27, 2021
Risk and Exposure Windows development
- Moved to Windows machine
- Tests now pass on Windows CLang 10.0.0 for MSVC Community 2019 amd64
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 27, 2021
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 27, 2021
…now running.

Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 28, 2021
Exposure change notification work continuing:-
- Running true/false now working in manager
- Basic change notification caching working (naive, unsafe)
- Correct analysis values coming out of exposure manager via notifications
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Nov 28, 2021
… running on Windows

Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 3, 2021
Added multi-variate data analysis
- Added Luminosity datatype
- Added RunningMean<ValT> datatype for a common data analysis use case
- Added extra test with RSSIMinute and RunningMean<Luminosity> analysis runners for exposure API
- Some minor analysis API fixes (constness, noexcept)
- Tests for risk API not yet passing (Work in progress)
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 4, 2021
Test templates refactoring
- Created generic dummy source instead of one per type - tests passing
- Fixed bug in ExposureManager where the first exposure change period was unset
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 5, 2021
Multiple analyses and exposures now working
- Fixed bug in UUID == method
- Fixed bug in allocatable array readlIndex method (Caused issues in exposure manager linking values to the correct agent)
- Multi-variate analyses in analysis API now working
- const SampleList iterators now working well
- Multiple exposure types supported in exposure manager
- RunningMean<ValT> datatype working well with exposure and analysis APIs
- Just the final risk score calculation to add now
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 5, 2021
Added primitives for RiskManager
- Tidied up STL imports in analysis API
- Added Sum aggregate to analysis API
- Added variety of human parameters (weight, sex, age) and associated Data Types
- Added ArrayMap type to represents one instance of each parameter
- Added a SampleDiseaseScreeningRiskModel (NOT for real world use)
- Added noexcept modifiers to SensorDelegate methods
- Shelled out RiskManager but without any methods yet (work in progress)
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 15, 2021
…h Risk Manager

Various Risk Score Manager changes
- More internal state tracking in Risk manager
- Links from Risk Manager to callbacks in exposure manager
- Invocation of risk models by risk manager
- Performance tweaks for dirty regions of risk models' scores
- UUID and Allocatable Array and agent class improvements
- Still need to complete ExposureManager.aggregate() calls, and need to define all values as full structs, not aliases to intrinsic types (as template creation fails)
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 18, 2021
…nother class

Abstracted in-memory exposure store to another class
- Created FixedMemoryExposureStore
- Both ExposureManager and RiskManagerExposureCallbackAdapter use FixedMemoryExposureStore, providing template independence
- Added Wrapper<UnderlyingT> template to provide intrinsic data type type safety for values (E.g. Age, Mass, PhenotypicSex)
- aggregate and produce methods not yet complete, so tests are still failing
- No ExposureStore implementation class or abstraction added yet
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 19, 2021
Risk analysis value accuracy changes
- Added Const Iterator option for Allocatable Array, which solved a lot of access issues
- Added time interval support to RunningMeanAnalyser
- Added checks in tests for exposure and risk score values as well as count
- Added strong type enforcement for UUID subclasses (Agent, AlgorithmId)
- Added FixedMemoryRiskScoreStore for storing risk scoring outputs in memory
- Added sinceOrEqual view filter for convenience
- Analysis API now includes value if its time is exactly the start of a time interval for analysis
- Fixed comment formatting in exposure_risk.h
- Completed aggregate() function in exposure manager, and added forEachExposure function for convenience
- Corrected bug in RiskScoreMetadata where algorithmId and agentId were being confused
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 19, 2021
Exposure and Risk API tests pass
- Fixed callbacks for just the exposure values that have changed
- Fixed calling risk scoring for each variable change, instead of each risk score change
- Fixed boundary issues with Risk and Exposure API processing
- All tests pass. Ready for beta2
Signed-off-by: Adam Fowler <adam@adamfowler.org>
@adamfowleruk
Copy link
Contributor Author

v2.1.0-beta2 released with the latest changes from this branch merged into develop.

De-prioritising non-required functionality for this release. Remaining TODOs therefore:-

Risk and Exposure stores:-

  • Add aggregate() function to RiskStore as exists inside ExposureStore (to allow retrieval by date, for example)
  • Add Exposure Manager addExposure() function call with different source but same everything else to allow merging of risk scores shared from another device (E.g. wearable to phone, or vice versa)
  • Add Zephyr external Flash disc Exposure store and Risk store
  • Add removeOlderThan function to both exposure manager and risk manager stores
  • Move index position based functions to iterator based functions in risk and exposure managers
  • Support saving and reading of more static Parameters to/from flash too (E.g. age, phylogenic sex, weight et al)

Exposure Notification:-

  • Add convert function to ExposureManager allowing conversion from humanProximity to (for example) Covid19Exposure (Derived Exposure) -> Consider doing this ephemerally based on stored source exposure types (i.e. 1:1 mapping)
  • Ensure this also works for rescind or modification (E.g. changing Confidence value, or lowering/increasing exposure score based on some external status notification change) - Note: Network/protocol mechanisms out of scope (will be part of OpenTraceV2 in a future release)

Risk Threshold Notification:-

  • Apply concept of Levels, states, alerts, and rules from old ExposureManager to a new RiskThresholdManager class
  • Allow the config of this to be stored, and loaded at runtime from flash storage

Out of scope:-

  • X Risk threshold / notification status messages, urls (more of a UI thing in the Java and iOS API)
  • X Storing to/from csv on windows/mac/linux (for now)
  • X CLIs for running risk models over csv stored data
  • X Any network comms or bluetooth comms for sync / notification at this stage (part of v2.2 of C++ and OpenTraceV2)

adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 30, 2021
Some performance and memory tweaks
- Compiles successfully on Ubuntu 20.04 again
- All tests pass on Windows 10 and Ubuntu 20.04
- Builds wearable and beacon code successfully
- Removed use of iostreams in SensorLogger (saving 5.5KB in the binary)
- Removed string output methods that were unused on Date
- Added StringBuffer class to make temporary string creation efficient
- Used strcpy instead of strcpy_s which was only supported on Windows
- Added nmsizecsv to output compiled binary sizes as a CSV for later analysis and visualisation
- Fixed template compilation bugs found by gcc on Ubuntu that weren't found by arm-gcc or clang on Windows
Signed-off-by: Adam Fowler <adam@adamfowler.org>
adamfowleruk added a commit to adamfowleruk/herald-for-cpp that referenced this issue Dec 30, 2021
Build enhancements for wearable
- Supports USB option changes in NCS 1.8/Zephyr 2.7
- Minimised includes used in wearable app, reducing build size by 26KB
- Removed most uses of string & date conversion, iostream, reducing build size by 4 KB
- V2.1.0 version number fix in CMake file for wearable app
Signed-off-by: Adam Fowler <adam@adamfowler.org>
@adamfowleruk adamfowleruk modified the milestones: v2.1, v2.2 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant