Skip to content

Instantly share code, notes, and snippets.

View rivant's full-sized avatar

Rick Thiessen rivant

View GitHub Profile
def run
check_environment
Daemons.run_proc('main.rb', daemon_options) do
server.listen_to_port(&process_msg)
end
end
namespace :labco do
desc 'Start Interface'
task :start do
puts `ruby -e "load 'interfaces/labco/main.rb';
HL7Engine::Interfaces::LabCo::Main.new(4481).run" start`
end
desc 'Stop Interface'
task :stop do
puts `ruby -e "load 'interfaces/labco/main.rb';
New:
class BaseNotifier
def initialize(attributes={})
@client_ip, @ec2_instance_id, @environment, @hl7_message,
@hl7_response, @queue_response, @stats, @title = %i(
client_ip ec2_instance_id environment hl7_message
hl7_response queue_response stats title
).map do |key|
attributes.fetch(key, '')
end
From this...
def status
if @pass
:info
else
:error
end
end
To this...
@rivant
rivant / gist:a7b23563aad6015e59f9
Created October 29, 2015 20:26
event_spec and event
describe '#event' do
it 'submits a custom event to data dog' do
datadog = HL7Engine::Interfaces::Labs2Go::DataDog.new(
env: ENV, pass: true, response: 'AA', stat: '[email protected]', title: 'T'
)
dog = double
event = double
time = double
allow(Time).to receive(:now).and_return(time)
@rivant
rivant / gist:5f7ad8389e0bcdb80afa
Created October 29, 2015 19:54
Data Dog is using msg instead of message
Dogapi::Event.new(
message,
msg_title: title,
date_happened: Time.now,
alert_type: status,
tags: tag
)
DECLARE STATUS_S15 INTEGER 0;
IF (ref_I_InputRootRef_PARM. XML.MRM ."NS1:CIM" ."NS1:MSH" ."NS1:MessageType" ."NS1:TheMessageType" = 'SIU' AND
COALESCE(ref_I_InputRootRef_PARM .XML .MRM ."NS1:CIM" ."NS1:MSH" ."NS1:MessageType" ."NS1:TriggerEvent" ,'' ) <> 'S15' AND
NOT(UTILS .FUNC_IsAbsoluteNull (ref_I_InputRootRef_PARM .XML .MRM ."NS1:CIM" ."NS1:AIL" ."NS1:LocationResourceID" ."NS1:PointOfCare" ))) THEN
IF ( COALESCE(ref_I_InputRootRef_PARM .XML .MRM ."NS1:CIM" ."NS1:SCH" ."NS1:FillerStatusCode" ."NS1:Identifier" ,'' ) <> 'C' AND
COALESCE(ref_I_InputRootRef_PARM .XML .MRM ."NS1:CIM" ."NS1:SCH" ."NS1:FillerStatusCode" ."NS1:Identifier" ,'' ) <> 'B' ) THEN
SET STATUS_S15 = 1;
@rivant
rivant / app.cm
Created August 15, 2014 20:49
app.cm.checkChanList
app.cm.checkChanList = function(Params,D){
for (var i=0;i < D.name.length; i++){
if (D.name[i] === Params.With){
return [D.name[i], true];
}
}
}
// Clicked on Import. Receives Channel name to check for existing and,
// site + credentials for the server to send to