yahl7 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c227a65905fb5ad0563e0b261bd4109d85c6386a513d9aab13536cb5e6d72ab0
4
- data.tar.gz: ca35e23d85f428b28bbcf7bfa190dea56372da467694a270ad3402b87dcbe083
3
+ metadata.gz: ead354fddaf6834942e7a7e23d46a965adf5f318cb730278844fefb728ad0a16
4
+ data.tar.gz: c6d4c697c4d32e1128401d37024d6518a57b798cb6400b73c4ec730fbf0085f4
5
5
  SHA512:
6
- metadata.gz: 062d71e29fe0023d5d5f9a589ae13e2ab59dd2792b2106b096943f8c0be73df7860adb550346b4c429728664d38edebcdc8c41cdfcf83ad3a8f01c360f320bf9
7
- data.tar.gz: 8d74af0d48e5d3afb462574e099c90a847ba7373154d265a606a603129529f5587f9a0dd74f3f3dbd076432d18d3e8c3dc82d17b2667d73f48fa7512c21ce9b6
6
+ metadata.gz: 3ff7e6dbfdc8b2a2c31c0025da6753c77a6b4c3dd400f57fd31010c6dca0439ecd17c3ad6e2c74140b3d16b970d9273f46d10efaa3c35204ef2b40b98765da71
7
+ data.tar.gz: f2c9a7572f48cfbc898ba902f3c0415b68a4d3509deb54b855856815bad69e6e33b3c3d41ec0b92d8d36f977d6429177d3ce6f16d3a970ff49e164dc0c4064ff
@@ -0,0 +1,7 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: "bundler" # See documentation for possible values
5
+ directory: "/" # Location of package manifests
6
+ schedule:
7
+ interval: "daily"
data/CHANGELOG.md CHANGED
@@ -5,6 +5,51 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.0] - 2021-09-01
9
+
10
+ ### Added
11
+
12
+ - HL7 data types:
13
+ - `TQ` for timing and quantity
14
+
15
+ ### Changed
16
+
17
+ - Mapped the following fields to the `TQ` data type:
18
+ - `OBR.27`
19
+ - `ORC.7`
20
+
21
+ ## [0.3.3] - 2021-09-01
22
+
23
+ This version comes with a few bugfixes
24
+
25
+ ### Fixed
26
+
27
+ - The mapping order of MSH fields was incorrect.
28
+ - When `YAHL7::V2::FieldParser` was given a `nil` value, the program could
29
+ crash. This condition should now be resolved.
30
+
31
+ ## [0.3.2] - 2021-09-01
32
+
33
+ 0.3.1 introduced a bug that is fixed in this release.
34
+
35
+ ### Fixed
36
+
37
+ - A bug in 0.3.1. We should have returned `YAHL7::V2::Message` but `nil` was
38
+ returned instead, resulting in an inconsistent API. This release fixed that
39
+ behavior and makes the API consistent again.
40
+
41
+ ## [0.3.1] - 2021-09-01
42
+
43
+ This release fixes a bug under certain circumstances. More details are listed
44
+ below.
45
+
46
+ ### Fixed
47
+
48
+ - A bug that could be encountered where messages that do not contain a message
49
+ type field caused a crash. This crash should now be fixed. When calling
50
+ `YAHL7::V2::Message.message_type` on a message body that does not contain the
51
+ type field, `nil` should now be returned rather than crashing.
52
+
8
53
  ## [0.3.0] - 2021-08-31
9
54
 
10
55
  The most significant part of this release is the addition of HL7 data types,
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+
5
+ require_relative 'ts'
6
+
7
+ module YAHL7
8
+ module V2
9
+ class DataType
10
+ # This is the HL7 data type for a timing and quantity.
11
+ class TQ < YAHL7::V2::DataType
12
+ include YAHL7::V2::AliasPersonName
13
+ include YAHL7::V2::AliasFieldNames
14
+
15
+ define_field_names({
16
+ quantity: 0,
17
+ interval: 1,
18
+ duration: 2,
19
+ start_datetime: { index: 3, class: YAHL7::V2::DataType::TS },
20
+ end_datetime: { index: 4, class: YAHL7::V2::DataType::TS },
21
+ priority: 5,
22
+ condition: 6,
23
+ text: 7,
24
+ conjunction: 8,
25
+ order_sequencing: 9,
26
+ occurrence_duration: 10,
27
+ total_occurrences: 11
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
@@ -3,6 +3,8 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  module Error
6
+ # This error is raised when the input for a given data type is implausible
7
+ # or otherwise invalid.
6
8
  class InvalidFormatError < StandardError
7
9
  end
8
10
  end
@@ -19,13 +19,8 @@ module YAHL7
19
19
  private
20
20
 
21
21
  def split_fields(body)
22
- fields = split_body(body, parse_options.field_sep)
23
-
24
- if fields.is_a?(String)
25
- split_components(fields)
26
- else
27
- fields.map { |f| split_components(f) }
28
- end
22
+ parts = split_body(body, parse_options.field_sep)
23
+ parts.is_a?(Array) ? parts.map { |f| split_components(f) } : split_components(parts)
29
24
  end
30
25
 
31
26
  def split_components(body)
@@ -43,6 +38,8 @@ module YAHL7
43
38
  end
44
39
 
45
40
  def split_body(body, separator)
41
+ return '' if body.nil?
42
+
46
43
  got = body.split(separator)
47
44
  got.count < 2 ? body : got
48
45
  end
@@ -3,6 +3,8 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Message
6
+ # ADT messages contain admit, discharge, and transfer information about
7
+ # patients.
6
8
  class ADT < YAHL7::V2::Message
7
9
  end
8
10
  end
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Message
6
+ # ORU messages contain unsolicited observation results about a patient.
6
7
  class ORU < YAHL7::V2::Message
7
8
  end
8
9
  end
@@ -45,9 +45,15 @@ module YAHL7
45
45
  # information, as this method simply finds the type code and then hands it
46
46
  # off to `get_message_class` to find the class to use.
47
47
  def self.message_type(body, parse_options = nil)
48
+ return self if body.length < 8
49
+
48
50
  parse_options ||= ParseOptions.from_body(body)
49
51
  head = body.split(parse_options.segment_sep)[0]
52
+ return self if head.nil?
53
+
50
54
  type = head.split(parse_options.repetition_sep)[8]
55
+ return self if type.nil?
56
+
51
57
  code = type.split(parse_options.component_sep)[0]
52
58
  get_message_class(code)
53
59
  end
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # AL1 segments contain patient allergy information.
6
7
  class AL1 < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # DG1 segments contain patient diagnosis information.
6
7
  class DG1 < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,8 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # EVN segments are used to communicate necessary trigger information to
7
+ # receiving applications.
6
8
  class EVN < YAHL7::V2::Segment
7
9
  include YAHL7::V2::AliasFieldNames
8
10
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # IN1 segments contain patient insurance coverage information.
6
7
  class IN1 < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,31 +3,32 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # MSH segments contain the intent, source, and destination of the HL7
7
+ # message.
6
8
  class MSH < YAHL7::V2::Segment
7
9
  include YAHL7::V2::AliasFieldNames
8
10
 
9
11
  define_field_names({
10
12
  field_separator: 1,
11
- encoding_characters: 2,
12
- sending_application: 3,
13
- sending_facility: 4,
14
- receiving_application: 5,
15
- receiving_facility: 6,
16
- message_datetime: { index: 7, class: YAHL7::V2::DataType::TS },
17
- security: 8,
18
- message_type: 9,
19
- message_control_id: 10,
20
- processing_id: 11,
21
- version_id: 12,
22
- sequence_number: 13,
23
- continuation_pointer: 14,
24
- accept_acknowledgement_type: 15,
25
- application_acknowledgement_type: 16,
26
- country_code: 17,
27
- character_set: 18,
28
- principal_language: 19,
29
- alternate_character_set_handling_scheme: 20,
30
- message_profile_identifier: 21
13
+ sending_application: 2,
14
+ sending_facility: 3,
15
+ receiving_application: 4,
16
+ receiving_facility: 5,
17
+ message_datetime: { index: 6, class: YAHL7::V2::DataType::TS },
18
+ security: 7,
19
+ message_type: 8,
20
+ message_control_id: 9,
21
+ processing_id: 10,
22
+ version_id: 11,
23
+ sequence_number: 12,
24
+ continuation_pointer: 13,
25
+ accept_acknowledgement_type: 14,
26
+ application_acknowledgement_type: 15,
27
+ country_code: 16,
28
+ character_set: 17,
29
+ principal_language: 18,
30
+ alternate_character_set_handling_scheme: 19,
31
+ message_profile_identifier: 20
31
32
  })
32
33
  end
33
34
  end
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # NTE segments contain notes and comments.
6
7
  class NTE < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # OBR segments contain observation request information about a patient.
6
7
  class OBR < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -33,7 +34,7 @@ module YAHL7
33
34
  diagnostic_service_section_id: 24,
34
35
  result_status: 25,
35
36
  parent_result: 26,
36
- quantity_timing: 27,
37
+ quantity_timing: { index: 27, class: YAHL7::V2::DataType::TQ },
37
38
  result_copies_to: 28,
38
39
  parent: 29,
39
40
  transportation_mode: 30,
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # OBX segments contain observation result information.
6
7
  class OBX < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # ORC segments contain information common to all orders.
6
7
  class ORC < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -13,7 +14,7 @@ module YAHL7
13
14
  placer_group_number: 4,
14
15
  order_status: 5,
15
16
  response_flag: 6,
16
- quantity_timing: 7,
17
+ quantity_timing: { index: 7, class: YAHL7::V2::DataType::TQ },
17
18
  parent_order: 8,
18
19
  transaction_datetime: 9,
19
20
  entered_by: 10,
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # PD1 segments contain additional patient demographic information.
6
7
  class PD1 < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # PID segments contain standard patient demographic information.
6
7
  class PID < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
@@ -3,6 +3,7 @@
3
3
  module YAHL7
4
4
  module V2
5
5
  class Segment
6
+ # PV1 segments contain information about the patient visit.
6
7
  class PV1 < YAHL7::V2::Segment
7
8
  include YAHL7::V2::AliasFieldNames
8
9
 
data/lib/yahl7/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YAHL7
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahl7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mylan Connolly
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple HL7 parser that focuses on being robust and easy to use
14
14
  email:
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".github/ISSUE_TEMPLATE/bug_report.md"
21
21
  - ".github/ISSUE_TEMPLATE/feature_request.md"
22
+ - ".github/dependabot.yml"
22
23
  - ".github/workflows/main.yml"
23
24
  - ".gitignore"
24
25
  - ".rspec"
@@ -42,6 +43,7 @@ files:
42
43
  - lib/yahl7/v2/data_type/dt.rb
43
44
  - lib/yahl7/v2/data_type/ft.rb
44
45
  - lib/yahl7/v2/data_type/ndl.rb
46
+ - lib/yahl7/v2/data_type/tq.rb
45
47
  - lib/yahl7/v2/data_type/ts.rb
46
48
  - lib/yahl7/v2/data_type/xad.rb
47
49
  - lib/yahl7/v2/data_type/xpn.rb