Lifen

Lifen is a Ruby client for Lifen FHIR API (over JSON).

Installation

Add this line to your application's Gemfile:

gem 'lifen-fhir'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lifen-fhir

Usage

Configuration

Lifen can be configured (ideally inside an initializer) like so:

Lifen.configure do |config|
  config.site                      = "https://demo.lifen.fr/"
  config.application_access_token  = "application_access_token"

  # optionnal
  config.proxy_url                 = "http://my.proxy.fr/"
end

Optionnal configuration:

  • proxy_url: enables you to route all your requests via a proxy

Internal

Managing a Binary

binary = Lifen::Binary.new(uuid: "b7c7dae671b93e951ce6a4f530736276")
binary.download

Communication Request

sender = Lifen::Practitioner.find_by_rpps("899900018483")

recipient = Lifen::Practitioner.find_by_rpps("899900018484")
channel = recipient.channels.first

binary = Lifen::Binary.new(uuid: "b7c7dae671b93e951ce6a4f530736276")

communication_request = Lifen::CommunicationRequest.new(sender: sender, recipient: recipient, channel: channel, binary: binary, patient: patient, category: category)

communication_request.send

Communication Request with multiple recipients

sender = Lifen::Practitioner.find_by_rpps("899900018483")

recipient = Lifen::Practitioner.find_by_rpps("899900018484")
medium = Lifen::Medium(uuid: recipient.channels.first.uuid)

other_recipient = Lifen::Practitioner.find_by_rpps("899900018484")
other_medium = Lifen::Medium(uuid: other_recipient.channels.first.uuid)

binary = Lifen::Binary.new(uuid: "b7c7dae671b93e951ce6a4f530736276")

communication_request_request = Lifen::CommunicationRequest.new(sender: sender, recipients: [recipient, other_recipient], medium: [medium, other_medium], binary: binary, patient: patient, category: category)

communication_request_request.send

Custom Channels management

recipient = Lifen::Practitioner.new(uuid: "valid-user-uuid")

# To create a new mailing address channel
channel = recipient.create_address(type: "address", lines: ["39 rue Aboukir"], city: "Paris", postal_code: "75002", country: "France")

# To create a new telecom channel fax
channel = recipient.create_telecom(type: "telecom", system: "fax", value: "+33102030405")

Deploying to Rubygems

Once the new version is validated, the deployment follows those steps :

  1. update lib/lifen/version.rb
  2. run bundle install to update Gemfile.lock
  3. update CHANGELOG.md with the additional features of the new version
  4. commit changes to Github
  5. build the gem using gem build lifen-fhir.gemspec
  6. publish the gem using gem publish lifen-fhir-X.X.X.gem
  7. run bundle update lifen in related projects :)

License

The MIT License (MIT)

Copyright (c) 2016-2017 Honestica

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.