Skip to content

Commit

Permalink
added doctors to HenrySmith44; added rake task to load providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganley committed Feb 27, 2012
1 parent d9c416a commit 87ce809
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 23 deletions.
44 changes: 22 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: http://github.com/projectcypress/health-data-standards.git
revision: 713b60620203bdb0f1d53a54c88cf34c356f6e90
revision: 33eb427029d7eeaf144ec861d407ba6cc41eac74
branch: develop
specs:
health-data-standards (0.7.1)
health-data-standards (0.7.2)
builder (~> 3.0.0)
erubis (~> 2.6)
mongoid (~> 2.4.2)
Expand Down Expand Up @@ -57,16 +57,16 @@ GEM
activesupport (3.2.1)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.6)
addressable (2.2.7)
ansi (1.4.2)
arel (3.0.0)
arel (3.0.2)
attr_required (0.0.5)
bcrypt-ruby (3.0.1)
bson (1.5.2)
bson_ext (1.5.2)
bson (= 1.5.2)
bson (1.6.0)
bson_ext (1.6.0)
bson (= 1.6.0)
builder (3.0.0)
capistrano (2.9.0)
capistrano (2.11.2)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
Expand All @@ -87,19 +87,19 @@ GEM
hashie
curb (0.7.18)
daemons (1.1.8)
devise (2.0.2)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
railties (~> 3.1)
warden (~> 1.1)
warden (~> 1.1.1)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.5.2)
factory_girl (2.6.0)
activesupport (>= 2.3.9)
factory_girl_rails (1.6.0)
factory_girl (~> 2.5.0)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
railties (>= 3.0.0)
feedzirra (0.0.31)
activesupport (>= 3.0.8)
Expand All @@ -112,7 +112,7 @@ GEM
rdoc (~> 3.8)
sax-machine (~> 0.0.20)
hashie (1.2.0)
heroku (2.20.0)
heroku (2.20.1)
launchy (>= 0.3.2)
rest-client (~> 1.6.1)
rubyzip
Expand All @@ -121,7 +121,7 @@ GEM
hike (1.2.1)
httpclient (2.2.4)
i18n (0.6.0)
journey (1.0.1)
journey (1.0.3)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
thor (~> 0.14)
Expand All @@ -144,13 +144,13 @@ GEM
method_source (0.7.0)
mime-types (1.17.2)
minitest (2.11.2)
mongo (1.5.2)
bson (= 1.5.2)
mongoid (2.4.4)
mongo (1.6.0)
bson (= 1.6.0)
mongoid (2.4.5)
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
multi_json (1.0.4)
multi_json (1.1.0)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
Expand Down Expand Up @@ -225,7 +225,7 @@ GEM
tilt (~> 1.1, != 1.3.0)
systemu (2.4.2)
term-ansicolor (1.0.7)
therubyracer (0.9.9)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
thin (1.3.1)
daemons (>= 1.0.9)
Expand All @@ -236,15 +236,15 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
turn (0.9.2)
turn (0.9.3)
ansi
tzinfo (0.3.31)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
uuid (2.3.5)
macaddr (~> 1.0)
warden (1.1.0)
warden (1.1.1)
rack (>= 1.0)
yamler (0.1.0)

Expand Down
42 changes: 42 additions & 0 deletions lib/tasks/hdata.rake
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,46 @@ puts patient.vital_signs.inspect

end


##############
##############
desc "Loads local C32 providers from test/fixtures/*Smith*.xml"
task :load_c32_providers => :environment do

if ENV['MONGOHQ_URL']
# uri = URI.parse(ENV['MONGOHQ_URL'])
@conn = Mongo::Connection.from_uri(ENV['MONGOHQ_URL'])
@db = @conn['hdata_server_production']
@coll = @db['records']
else
@conn = Mongo::Connection.new
#@db = @conn['hds-atest']
@db = @conn['hdata_server_development']
@coll = @db['records']
end

## read XML files and load into DB
files = Dir.glob("#{Rails.root}/test/fixtures/*Smith*.xml")
puts "Files #{files}"
# files = Dir.glob(File.dirname(__FILE__) + "/../test/fixtures/*Smith*.xml")
files.each do |file|
nist_doc = Nokogiri::XML(File.new(file))
nist_doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
importer = HealthDataStandards::Import::C32::ProviderImporter.instance

providers = importer.extract_providers(nist_doc)

puts "****** providers"
puts providers.inspect

providers.each do |provider|
p = Provider.new provider
puts "ERR" if p.save! == false
puts "Saved a provider! #{p.title} #{p.family_name} of #{p.organization}"
end
end

end


end
155 changes: 154 additions & 1 deletion test/fixtures/Henry_Smith_44.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,159 @@
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<documentationOf>
<serviceEvent classCode="PCPR">
<effectiveTime>
<low value="19650120"/>
<high value="20070209"/>
</effectiveTime>

<performer typeCode="PRF">
<templateId root="2.16.840.1.113883.3.88.11.83.4" assigningAuthorityName="HITSP C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.3" assigningAuthorityName="IHE PCC"/>
<functionCode code="PP" displayName="Primary Care Provider" codeSystem="2.16.840.1.113883.12.443" codeSystemName="Provider Role">
<originalText>Primary Care Provider</originalText>
</functionCode>
<time>
<low value="20020716"/>
<high value="20070915"/>
</time>
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="808401234567893"/>
<code code="Cardilogist" displayName="Allopathic and Osteopathic Physicians" codeSystemName="Provider Codes" codeSystem="2.16.840.1.113883.6.101"/>
<addr/>
<telecom value="tel:+1-301-975-3251" use="HP"/>
<assignedPerson>
<name>
<prefix>Dr.</prefix>
<given>Henry</given>
<family>Frost</family>
</name>
<sdtc:birthTime nullFlavor="ASKU"/>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.72.5"/>
<name>Greater Heart Care</name>
<telecom value="tel:+1-781-456-1800"/>
<addr>
<street>750 Washington St.</street>
<city>Boston</city>
<state>MA</state>
</addr>
</representedOrganization>
<sdtc:patient>
<sdtc:id/>
</sdtc:patient>
</assignedEntity>
</performer>

<performer typeCode="PRF">
<templateId root="2.16.840.1.113883.3.88.11.83.4" assigningAuthorityName="HITSP C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.3" assigningAuthorityName="IHE PCC"/>
<functionCode code="CP" displayName="Consulting Provider" codeSystem="2.16.840.1.113883.12.443" codeSystemName="Provider Role"/>
<originalText>Consulting Provider</originalText>
<time>
<low value=""/>
<high value=""/>
</time>
<assignedEntity>
<id extension="1234567893" root="2.16.840.1.113883.3.72.5.2"/>
<code code="Oncologist" displayName="Speech, Language and Hearing Providers" codeSystem="2.16.840.1.113883.6.101" codeSystemName="ProviderCodes"/>
<assignedPerson>
<name>
<prefix>Dr.</prefix>
<given>Cornelius</given>
<family>Fields</family>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.72.5"/>
<name>Oncology Med.</name>
<telecom value="tel:+1-781-453-2000"/>
<addr>
<street>750 Washington St.</street>
<city>Boston</city>
<state>MA</state>
</addr>
</representedOrganization>
<sdtc:patient>
<sdtc:id root="78A150ED-B890-49dc-B716-5EC0027B3983" extension="MedicalRecordNumber"/>
</sdtc:patient>
</assignedEntity>
</performer>

<performer typeCode="PRF">
<templateId root="2.16.840.1.113883.3.88.11.83.4" assigningAuthorityName="HITSP C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.3" assigningAuthorityName="IHE PCC"/>
<functionCode code="CP" displayName="Consulting Provider" codeSystem="2.16.840.1.113883.12.443" codeSystemName="Provider Role"/>
<originalText>Consulting Provider</originalText>
<time>
<low value=""/>
<high value=""/>
</time>
<assignedEntity>
<id extension="1184627374" root="2.16.840.1.113883.3.72.5.2"/>
<code code="Dermatologist" displayName="Dermatology" codeSystem="2.16.840.1.113883.6.101" codeSystemName="ProviderCodes"/>
<assignedPerson>
<name>
<prefix>Dr.</prefix>
<given>Thomas</given>
<family>Dorms</family>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.72.5"/>
<name>Dermatology Assoc.</name>
<telecom value="tel:+1-301-555-5555"/>
<addr>
<street>44 Binney St.</street>
<city>Boston</city>
<state>MA</state>
</addr>
</representedOrganization>
<sdtc:patient>
<sdtc:id root="78A150ED-B890-49dc-B716-5EC0027B3983" extension="MedicalRecordNumber"/>
</sdtc:patient>
</assignedEntity>
</performer>

<performer typeCode="PRF">
<templateId root="2.16.840.1.113883.3.88.11.83.4" assigningAuthorityName="HITSP C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.3" assigningAuthorityName="IHE PCC"/>
<functionCode code="CP" displayName="Consulting Provider" codeSystem="2.16.840.1.113883.12.443" codeSystemName="Provider Role"/>
<originalText>Consulting Provider</originalText>
<time>
<low value=""/>
<high value=""/>
</time>
<assignedEntity>
<id extension="1538165659" root="2.16.840.1.113883.3.72.5.2"/>
<code code="Radiologist" displayName="Dermatology" codeSystem="2.16.840.1.113883.6.101" codeSystemName="ProviderCodes"/>
<assignedPerson>
<name>
<prefix>Dr.</prefix>
<given>Caldwell</given>
<family>Jones</family>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.3.72.5"/>
<name>Radiology Assoc.</name>
<telecom value="tel:+1-301-555-5555"/>
<addr>
<street>23 Peidmont St.</street>
<city>Boston</city>
<state>MA</state>
</addr>
</representedOrganization>
<sdtc:patient>
<sdtc:id root="78A150ED-B890-49dc-B716-5EC0027B3983" extension="MedicalRecordNumber"/>
</sdtc:patient>
</assignedEntity>
</performer>

</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
Expand Down Expand Up @@ -1343,4 +1496,4 @@
</component>
</structuredBody>
</component>
</ClinicalDocument>
</ClinicalDocument>

0 comments on commit 87ce809

Please sign in to comment.