Skip to content

Commit

Permalink
Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawalonoski committed Mar 15, 2018
1 parent 01e843d commit 705d29e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ The StructureDefinitions, XML Schemas, and examples are reused from the [HL7 FHI
### Getting Started
```
$ bundle install
$ bundle exec rake fhir:generate
$ bundle exec rake fhir:console
```

Expand All @@ -19,9 +18,62 @@ $ bundle exec rake fhir:console
- Primitive Extensions
- FHIR Comments

### Resource Basics

Using XML...
```ruby
xml = File.read('patient-example.xml')
patient = FHIR.from_contents(xml)
puts patient.to_xml
```
Using JSON...
```ruby
json = File.read('patient-example.json')
patient = FHIR.from_contents(json)
puts patient.to_json
```

Creating an `Observation` by hand...
```ruby
obs = FHIR::Observation.new(
'status' => 'final',
'code' => {
'coding' => [{ 'system' => 'http://loinc.org', 'code' => '3141-9', 'display' => 'Weight Measured' }],
'text' => 'Weight Measured'
},
'category' => {
'coding' => [{ 'system' => 'http://hl7.org/fhir/observation-category', 'code' => 'vital-signs' }]
},
'subject' => { 'reference' => 'Patient/example' },
'context' => { 'reference' => 'Encounter/example' }
)
obs.valueQuantity = FHIR::Quantity.new(
'value' => 185,
'unit' => 'lbs',
'code' => '[lb_av]',
'system' => 'http://unitsofmeasure.org'
)
```

### Validation

Using built in validation...
```ruby
patient.valid? # returns true or false
patient.validate # returns Hash of errors, empty if valid
```

Using a profile or structure definition...
```ruby
sd = FHIR::Definitions.resource_definition('Patient')
sd.validates_resource?(patient) # passing in FHIR::DSTU2::Patient
# Validation failed? Get the errors and warnings...
puts sd.errors
puts sd.warnings
```
# License

Copyright 2014-2016 The MITRE Corporation
Copyright 2014-2018 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'pry'

Dir['lib/fhir_models/tasks/**/*.rake'].each do |file|
load file
Expand Down
8 changes: 4 additions & 4 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require 'fhir_models'
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require 'pry'
Pry.start

require 'irb'
IRB.start
# require 'irb'
# IRB.start
6 changes: 3 additions & 3 deletions fhir_models.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'nokogiri', '>= 1.6'
spec.add_dependency 'nokogiri', '>= 1.8'
spec.add_dependency 'date_time_precision', '>= 0.8'
spec.add_dependency 'bcp47', '>= 0.3'
spec.add_dependency 'mime-types', '>= 1.16'
spec.add_dependency 'mime-types', '>= 1.16', '< 3'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
Expand All @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'nokogiri-diff'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop', '0.49'
spec.add_development_dependency 'codeclimate-test-reporter'
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency 'guard-test'
Expand Down

0 comments on commit 705d29e

Please sign in to comment.