Skip to content

Instantly share code, notes, and snippets.

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

Jimmy Dee jdee

🏳️‍🌈
View GitHub Profile
@jdee
jdee / cucumber output
Created October 26, 2010 22:22
smoking gun?
jdee@fatman:webapp$ bundle exec cucumber -r features/support/env.rb -r features/support/standard.rb -r features/shared_step_definitions -r features/standard_step_definitions --tags @pending features/standard/staging_area.feature:213
Feature: Staging Electronic Messages
To process electonically submitted messages
A user needs to be able to view messages and assign them to CMRs
@pending
Scenario: Assigning a staged message with a home phone number # features/standard/staging_area.feature:213
Given I am logged in as a super user # features/standard_step_definitions/common_helper_steps.rb:22
And I have the staged message "realm_campylobacter_jejuni" # features/standard_step_definitions/accept_staged_messages_as_hl7_steps.rb:19
@jdee
jdee / rake output
Created October 26, 2010 14:40
ee failure during db_rebuild_full
== GeocodeForCsv: migrating ==================================================
rake trisano:ee:load_defaults
(in /home/jdee/github/csinitiative/trisano/webapp)
Loading EE defaults
Loading addiitonal EE privileges
Adding EE privs to existing roles
Load geocode csv fields
rake aborted!
PGError: ERROR: relation "csv_field_translations" does not exist
LINE 1: INSERT INTO csv_field_translations (id, csv_fi...
@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
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 / 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}" # <<<<
@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@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
** 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'
class MessageBatch < ActiveRecord::Base
has_many :staged_messages, :dependent => :nullify, :after_remove => :message_removed
def message_removed(message)
destroy if staged_messages.empty?
end
@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.