class MetricHandler

Defined in:

handlers/metric_handler.cr

Constant Summary

ALLOWED_CALLBACK_HOSTS = ENV["ALLOWED_CALLBACK_HOSTS"]?.try() do |__arg0| (__arg0.split(",")).map(&.strip) end || ["discord-bot", "localhost"]
CONTROLLED_SUBSTANCES = Set {"alprazolam", "clonazepam", "diazepam", "lorazepam", "temazepam", "oxazepam", "midazolam", "nitrazepam", "bromazepam", "zolpidem", "methylphenidate", "amphetamine", "dextroamphetamine", "lisdexamfetamine", "methamphetamine", "cocaine", "dextroamphetamine phosphate", "morphine", "codeine", "oxycodone", "hydrocodone", "hydromorphone", "fentanyl", "methadone", "buprenorphine", "heroin", "tramadol", "ketamine", "esketamine", "ghb", "pregabalin", "gabapentin", "modafinil", "armodafinil"}

Substances that should never be filtered (controlled/scheduled)

HRT_SUBSTANCES = Set {"estradiol", "estradiol enanthate", "estradiol hemihydrate", "estradiol undecylate", "estradiol valerate", "progesterone", "triptorelin", "cyproterone acetate", "bicalutamide", "spironolactone"}

HRT substances always excluded from wrapped analytics

Log = JosieHealth::Utils::Log
NON_RECREATIONAL_CATEGORIES = Set {"supplement", "beta-blocker", "antiemetic", "cardiovascular", "prokinetic", "hormone", "estrogen", "medication", "analgesic", "antipyretic"}
WRAPPED_CR_URL = ENV["WRAPPED_CR_URL"]? || "http://wrapped-cr:3002"

Wrapped-cr service URL (Crystal service for image generation)

WRAPPED_SERVICE_URL = ENV["WRAPPED_SERVICE_URL"]? || "http://wrapped:3002"

Wrapped service URL (legacy Ruby service for video generation)

Constructors

Instance Method Summary

Constructor Detail

def self.new(redis_client : RedisClient) #

Instance Method Detail

def handle(request : HTTP::Request, response : HTTP::Server::Response, authenticated_user : String | Nil = nil) #

def handle_analytics(request : HTTP::Request, response : HTTP::Server::Response) #

def redis_ping : Bool #