~umgeher/utos-usr-local-hcs-exam-ecg

ref: 67b7a6f4e83990d7d5591d5cd8c3f01486a4efa4 utos-usr-local-hcs-exam-ecg/src/utos_usr_local_hcs_exam_ecg_wb_drop.erl -rw-r--r-- 715 bytes
67b7a6f4Umgeher Torgersen qt-ai upgraded to 0.2.0 1 year, 27 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-module(utos_usr_local_hcs_exam_ecg_wb_drop).

-include_lib("utos_usr_local_hcs_exam_include/src/utos_usr_local_hcs_exam_include.hrl").

-export([drop/2]).

drop(#wb{ecg = ECG, phy = Phy, uid = null} = WB, Influx) when is_binary(ECG), is_binary(Phy) ->
    {ok, UID} = utos_usr_local_hcs_exam_ecg:wb_uid(ECG, Phy),
    drop(WB#wb{uid = UID}, Influx);
drop(#wb{exam = Exam, uid = null} = WB, Influx) when is_binary(Exam) ->
    {ok, ECG} = utos_usr_local_hcs_exam_ecg:uid(Exam),
    drop(WB#wb{ecg = ECG}, Influx);
drop(#wb{uid = UID} = WB, {Influx, DB}) when is_binary(UID) ->
    utos_usr_local_hcs_exam_ecg:notify_bus({wb, drop, WB}),
    _ = utos_usr_db_influx:drop_measurement(Influx, DB, UID),
    {ok, drop}.