Skip to content

Commit

Permalink
Bump HL7 to 0.8.0 (#80)
Browse files Browse the repository at this point in the history
- Update to elixir_hl7 0.8.0
- Update MLLP.ACk and ack_test where required per update
- Bump our version to 0.9.4
  • Loading branch information
starbelly authored Nov 10, 2023
1 parent fc8ae88 commit ce2f65c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.3
0.9.4
2 changes: 1 addition & 1 deletion lib/mllp/ack.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ defmodule MLLP.Ack do
|> List.replace_at(6, sending_facility)
|> List.replace_at(3, receiving_application)
|> List.replace_at(5, sending_application)
|> List.replace_at(9, "ACK^#{HL7.Query.get_part(hl7, ~g{MSH-9.2})}^ACK")
|> List.replace_at(9, "ACK^#{HL7.Query.find_first(hl7, ~p{MSH-9.2})}^ACK")

msa = ["MSA", code, message_control_id, text_message]

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule MLLP.MixProject do
[
{:telemetry, "~> 1.0"},
{:ranch, "~> 1.8.0"},
{:elixir_hl7, "~> 0.7.0"},
{:elixir_hl7, "~> 0.8.0"},
{:backoff, "~> 1.1.6"},
{:ex_doc, "~> 0.24.2", only: :dev, runtime: false},
{:dialyxir, "~> 1.1.0", only: [:dev, :test], runtime: false},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"},
"elixir_hl7": {:hex, :elixir_hl7, "0.7.3", "3b130c59867f3d022119225a983db666c7a22a3f6280b796318dc6fec2c353df", [:mix], [], "hexpm", "a80488c65ed5ba22b98b26f96ab09c35bd04136af08e38ba4d7f77f1f35f6c5e"},
"elixir_hl7": {:hex, :elixir_hl7, "0.8.0", "172b6fb68facc9fe68389746004ca6fddda4ae9c97c5ff6319f22fae56186d0c", [:mix], [], "hexpm", "5f067a58e02ce88ef50394e3f39a256c2780290ce1105715dc339670b6ac1b89"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"},
"excoveralls": {:hex, :excoveralls, "0.14.6", "610e921e25b180a8538229ef547957f7e04bd3d3e9a55c7c5b7d24354abbba70", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "0eceddaa9785cfcefbf3cd37812705f9d8ad34a758e513bb975b081dce4eb11e"},
Expand Down
38 changes: 19 additions & 19 deletions test/ack_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,87 +11,87 @@ defmodule AckTest do
|> HL7.Message.new()

ack = Ack.get_ack_for_message(bad_message, "AA")
assert "AR" == ack |> get_part(~g{MSA-1})
assert "AR" == ack |> find_first(~p{MSA-1})
assert "ACK" == ack.header.message_type
assert ack |> get_part(~g{MSA-3}) =~ "missing_header"
assert ack |> find_first(~p{MSA-3}) =~ "missing_header"
end

test "for an invalid HL7 string" do
bad_message = "Bad Message"

ack = Ack.get_ack_for_message(bad_message, "AA")
assert "AR" == ack |> get_part(~g{MSA-1})
assert "AR" == ack |> find_first(~p{MSA-1})
assert "ACK" == ack.header.message_type

assert ack |> get_part(~g{MSA-3}) ==
assert ack |> find_first(~p{MSA-3}) ==
"Message was not parsable as HL7. Reason: missing_header"
end

test "with code `application_accepted`" do
hl7_ack = get_ack_for_wikipedia_example(:application_accept)
assert "AA" == hl7_ack |> get_part(~g{MSA-1})
assert "AA" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `AA`" do
hl7_ack = get_ack_for_wikipedia_example("AA")
assert "AA" == hl7_ack |> get_part(~g{MSA-1})
assert "AA" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `CA`" do
hl7_ack = get_ack_for_wikipedia_example("CA")
assert "CA" == hl7_ack |> get_part(~g{MSA-1})
assert "CA" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `application_reject`" do
hl7_ack = get_ack_for_wikipedia_example(:application_reject)
assert "AR" == hl7_ack |> get_part(~g{MSA-1})
assert "AR" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `AR`" do
hl7_ack = get_ack_for_wikipedia_example("AR")
assert "AR" == hl7_ack |> get_part(~g{MSA-1})
assert "AR" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `CR`" do
hl7_ack = get_ack_for_wikipedia_example("CR")
assert "CR" == hl7_ack |> get_part(~g{MSA-1})
assert "CR" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `application_error`" do
hl7_ack = get_ack_for_wikipedia_example(:application_error)
assert "AE" == hl7_ack |> get_part(~g{MSA-1})
assert "AE" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `AE`" do
hl7_ack = get_ack_for_wikipedia_example("AE")
assert "AE" == hl7_ack |> get_part(~g{MSA-1})
assert "AE" == hl7_ack |> find_first(~p{MSA-1})
end

test "with code `CE`" do
hl7_ack = get_ack_for_wikipedia_example("CE")
assert "CE" == hl7_ack |> get_part(~g{MSA-1})
assert "CE" == hl7_ack |> find_first(~p{MSA-1})
end

test "returns an ACK message with the proper message_type" do
hl7_ack = get_ack_for_wikipedia_example(:application_accept)
assert "ACK" == hl7_ack.header.message_type
assert "A01" == hl7_ack.header.trigger_event
assert "ACK" == HL7.Query.get_part(hl7_ack, ~g{MSH-9.3})
assert "ACK" == HL7.Query.find_first(hl7_ack, ~p{MSH-9.3})
end

test "return an ACK message with a matching message_control_id" do
hl7_ack = get_ack_for_wikipedia_example(:application_accept)

assert "01052901" == hl7_ack |> new() |> get_part(~g{MSA-2})
assert "01052901" == hl7_ack |> new() |> find_first(~p{MSA-2})
end

test "returns an ACK message with the sender and receiver fields properly reversed" do
hl7_ack = get_ack_for_wikipedia_example(:application_accept)

assert "MegaReg" == hl7_ack |> get_part(~g{MSH-5})
assert "XYZHospC" == hl7_ack |> get_part(~g{MSH-6})
assert "SuperOE" == hl7_ack |> get_part(~g{MSH-3})
assert "XYZImgCtr" == hl7_ack |> get_part(~g{MSH-4})
assert "MegaReg" == hl7_ack |> find_first(~p{MSH-5})
assert "XYZHospC" == hl7_ack |> find_first(~p{MSH-6})
assert "SuperOE" == hl7_ack |> find_first(~p{MSH-3})
assert "XYZImgCtr" == hl7_ack |> find_first(~p{MSH-4})
end
end

Expand Down

0 comments on commit ce2f65c

Please sign in to comment.