Skip to content

Instantly share code, notes, and snippets.

View jdee's full-sized avatar
🏳️‍🌈

Jimmy Dee jdee

🏳️‍🌈
View GitHub Profile
jdee@fatman:~/github/csinitiative/trisano/webapp$ script/runner vttest.rb
arup_1: LOINC=13954-3 (scale Ord) ST [Positive]
unknown_observation_value: LOINC=13954-3 (scale Ord) ST [Scary]
arup_2: LOINC=5221-7 (scale <nil>) ST [Sick]
arup_2: LOINC=13954-3 (scale Ord) ST [Very sick]
arup_3: LOINC=5221-7 (scale <nil>) ST [Sick]
arup_3: LOINC=13954-3 (scale Ord) ST [Very sick]
ihc_1: LOINC=00000-0 (scale <nil>) TM [200902250930Z]
ihc_1: LOINC=00000-0 (scale <nil>) PN [PETERSEN^FINN^B.]
ihc_1: LOINC=00000-0 (scale <nil>) TN [8014081819]
@jdee
jdee / seqnum.rb
Created September 15, 2010 20:06
#!/usr/bin/env ruby
class A
class << self
def next_sequence_number
@next_sequence_number += 1
end
end
@next_sequence_number = 0
@jdee
jdee / winner.c
Created September 17, 2010 18:32
/*
LEAST LIKELY TO COMPILE SUCCESSFULLY:
IanPhillipps, Cambridge Consultants Ltd., Cambridge, England
A appropriate program for December 25th, this consists primarily of
calls to main() combined by a lot of the ternary conditional (?:)
opators. Have you ever seen a more forceful return? The judges note
that this program looked like what you would get by pounding on the keys
of a type writer at random.
class MessageBatch < ActiveRecord::Base
has_many :staged_messages, :dependent => :nullify, :after_remove => :message_removed
def message_removed(message)
destroy if staged_messages.empty?
end
** Execute features
/home/jdee/.rvm/rubies/jruby-1.5.2/bin/jruby -I "/home/jdee/.rvm/gems/jruby-1.5.2/gems/cucumber-0.6.3/lib:lib" "/home/jdee/.rvm/gems/jruby-1.5.2/gems/cucumber-0.6.3/bin/cucumber" --format pretty -p standard --tags ~@pending
Using the standard profile...
undefined method `add_path_to' for main:Object (NoMethodError)
/home/jdee/github/csinitiative/trisano-ee/plugins/trisano_ee/features/support/paths.rb:1
/home/jdee/github/csinitiative/trisano-ee/plugins/trisano_ee/features/support/paths.rb:64:in `require'
/home/jdee/.rvm/gems/jruby-1.5.2/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/jdee/.rvm/gems/jruby-1.5.2/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/home/jdee/.rvm/gems/jruby-1.5.2/gems/cucumber-0.6.3/bin/../lib/cucumber/rb_support/rb_language.rb:124:in `load_code_file'
/home/jdee/.rvm/gems/jruby-1.5.2/gems/cucumber-0.6.3/bin/../lib/cucumber/step_mother.rb:85:in `load_code_file'
jdee@fatman:~/github/csinitiative/trisano/webapp$ cat check_cr.rb
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), 'features', 'support',
'hl7_messages')
puts "a CR character in a here doc becomes " +
HL7MESSAGES[:empty_batch].slice(96,1).inspect
jdee@fatman:~/github/csinitiative/trisano/webapp$ rvm list
@jdee
jdee / gist:634852
Created October 19, 2010 19:14
when is a format not a format?
# from the API script
CONTENT_TYPE=application/edi-hl7v2
Content-Type=
format=*/* # <<<<< huh???
in before_filter :check_contents: @staged_message.hl7_message.is_a String
# from my Java client
CONTENT_TYPE=application/edi-hl7v2
Content-Type=
@jdee
jdee / staged_messages_controller.rb
Created October 19, 2010 19:30
add these three lines
def check_contents
@staged_message = StagedMessage.new params[:staged_message]
@staged_message.hl7_message ||= request.body.read.chomp
puts "CONTENT_TYPE=#{request.env['CONTENT_TYPE']}" # <<<< line 183
puts "Content-Type=#{request['Content-Type']}" # <<<<
puts "format=#{request.format}" # <<<<
from my little java app:
request.env['CONTENT_TYPE']="application/edi-hl7v2"
request.env['Content-Type']=nil
request['CONTENT_TYPE']=nil
request['Content-Type']=nil
request.format=#<Mime::Type:0x453e22ee @synonyms=["application/edi-hl7"], @string="application/edi-hl7v2", @symbol=:hl7>
from the ruby API script:
request.env['CONTENT_TYPE']="application/edi-hl7v2"
request.env['Content-Type']=nil
@jdee
jdee / gist:636601
Created October 20, 2010 15:13
posting an HL7 message
jdee@fatman:~/github/csinitiative/trisano/client-web-api/ruby/staged_messages$ export TRISANO_BASE_URL=http://localhost:3000
jdee@fatman:~/github/csinitiative/trisano/client-web-api/ruby/staged_messages$ export TRISANO_API_CONTENT_TYPE=application/edi-hl7v2
jdee@fatman:~/github/csinitiative/trisano/client-web-api/ruby/staged_messages$ ruby staged_messages.rb ../../../webapp/lib/hl7/samples/realm-minimal-message.hl7
Using the following custom headers:
{"Content-Type"=>"application/edi-hl7v2"}
Processing message 1
Message number 1 could not be processed due to the following errors (TrisanoWebError):
* HL7 Message is missing the header
* HL7 Message is missing the header
* HL7 Message is missing the header