Coder Social home page Coder Social logo

daskott / kronus Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 329 KB

Simple CLI tool for assessing aliveness of users. And executes preset actions based on the results.

License: Apache License 2.0

Go 99.73% Makefile 0.27%
cli-app go golang cli dead-man-switch

kronus's People

Contributors

daskott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kronus's Issues

Support extensions for different types of probe messages

Note

  • Add extension_id to probe_settings where extensions could be none, joke, bible verse etc.
  • If extension is enabled, based on extension, get text & send back to user.

E.g. joke - you get a joke with your probe, or custom-questions - you get a custom puzzle, if solved correctly, that means you're okay, math - get a random math problem each time to check if you're okay

Ability to add personal notes for recipients

User can add multiple notes. Each note has a trigger e.g. Send note to emergency contact after 1hour/30days of being unavailable.

Use cases:

  • Send personal note to loved ones - doesn't contain any secrets
  • Share encrypted content(for which the recipient has the key) - which could have passwords etc
  • The note can contain information on what to do if user is no longer available ๐Ÿ˜ข

Investigation

  • Look into storing public key pair for users to handle encryption of personal messages ?
    • The server can store the public key & then make the user download the private key. I.e emergency contacts will need to have key pair generated for them. And the message will be encrypted using the recipients public key.
    • The author of the message will also have a copy encrypted with their public key so they can update the message whenever they want.

Add/Update endpoints for kronus server

  • POST /users - return user_id/info on user creation
  • Return 400 for bad request(e.g db errors like duplicate data or failed constraints) instead of 500
  • GET /probes - should work without status filter
  • GET /jobs - should work without status filter
  • Support Pagination on all endpoints that require it
  • GET /users/{id}/probes
  • API versioing
  • Update docs accordingly

Add initial tests for server

Start with probeScheduler

TODO:

  • --test mode should use in:memory db for test
  • Test that ScheduleProbes:
    • Loads crons for probes where users have their probe_settings set to active
    • Loads crons for probe followups i.e. ENQUEUE_FOLLOWUP_PROBES_HANDLER
  • Test that the probes are executed when they are suppose to be ?
    • Perhaps this should not be a probeScheduler test, but a wokerPool test ?

Ability to create probe via sms

A user can text the server something like:

probe 15m

And a probe will sent to the user in 15m, with 0 retries. Can be done through scheduled jobs.

TODO:

  • user.probe_settings should have max_retries & wait_time_in_minutes(i.e. time to wait for a reply after which the probe is retried or is marked as unavailable)
  • When creating a probe use the users user.probe_settings to set max_retries & wait_time_in_minutes - they should also be fields in probe.
  • Add scheduledAt column to jobs table.
  • When user sends sms command, create a job added to the scheduled queue & set scheduledAt(i.e. when the job should be run)
  • Create a new worker that only pulls jobs from the scheduled queue & move them to the enqueued queue if scheduledAt <= time.Now()
  • The scheduled job should have ["probe_max_retries"] arg set to 0. So after the user's dynamic probe triggers, if they don't reply, immediately mark as unavailable & contact emergency contact.

Enhancement:

  • Move this logic into a database query:
    // Only send out followup probe after at least 1 hour after the last probe was sent,
    // until max-retries. So the user has enough time to respond.
    //
    // E.g sendInitialProbe @ 5:OOpm
    // Follow up 1 will be @ ~6:00pm
    // Follow up 2 will be @ ~7:00pm
    // Follow up 3 will be @ ~8:00pm
    //
    // And if no respons, @ ~9:00pm send out emergency probe
    if time.Since(*probe.UpdatedAt) < 1*time.Hour {
    continue
    }

Note:

  • Perhaps multiple retries & shorter wait times for dynamic probes
  • The ability to do this via text should be deprecated at some point, but the feature can still be used in a diff interface

Add location information for users to kronus server

Send link with probe, to get user location via browser & store location for each probe

Benefits:

  • Simple

Problems:

  • Information is not realtime
  • Requires very frequent probes to make information more useful
  • User experience is not great

Constraints:

  • With the use of links, no need to receive Y/N response. Clicking on the link indicates you're okay & sends your location. However, we need to still be able to send Y/N response, for cases where the user has no internet or doesn't want to send location info.

Questions:

  • Should the link have Y/N option ? Or should clicking the link prove you're okay ?

Todo:

  • Move entire probe verification to web app. User gets' notified with link & they click to verify aliveness
  • Given the current constraints, make it as user friendly as possible.
    • Ask user on web_page to include location co-ordinates

Later:

  • We could have a mobile app that auto transmits location on each probe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.