OCHA-DAP / hdx-signals

HDX Signals
https://un-ocha-centre-for-humanitarian.gitbook.io/hdx-signals/
GNU General Public License v3.0
6 stars 0 forks source link

243 refinement of triage signals function #246

Closed martinig94 closed 3 weeks ago

martinig94 commented 1 month ago

Deals with with issue 243

Due to a branch renaming some previous comments are in a closed PR. All the comments have been addressed and an additional change has been added:

caldwellst commented 1 month ago

Looks great to me! Will leave to @zackarno to approve!

zackarno commented 1 month ago

looks like a nice addition! i get a little blocked trying to figure out how to interactively step through triage_signals() for testing. Could one of you could explain how to do that step by step here -- it would be useful for this review and myself/others in the future

Seth gave me some specific steps to follow to allow debugging. Have written them down in internal doc, but perhaps Giulia and I can develop something more formal later. Nonetheless will summarise here so we it's at least somewhere we can reference for now (feel free to fill in gaps):

  1. Can't interactively to debug w/ out a parquet file in output/indicator_id/test/ (path made by cs$signals_path). Therefore you need to create this test file by running a manual GHA workflow (i.e wfp_market_monitor) with the following parameters set (leave all the rest on default) a. HS_LOCAL = FALSE b. HS_DRY_RUN=TRUE
  2. To actually send any emails (test or not) you will need to set HS_ADMIN_NAME - this should just be your name
  3. Then when running debugging in you R session the file will be available on the blob. To actually get the test email you will have to set HS_LOCAL=FALSE manually in you Rsession and test param in triage_signals() is TRUE. So code could look like:
debugonce(triage_signals$triage_signals)
Sys.setenv("HS_LOCAL" = FALSE) # if u dont do this, email wont send
triage_signals$triage_signals(indicator_id,n_campaigns = 1, test=TRUE) # if test = TRUE email will send

If you were to accidentally put test= FALSE you could potentially send signal externally, but it's very unlikely as the process will most likely be aborted when the non-test parquet file is not found in the scanned directory