Module: DaVinciPASTestKit::Generator::Descriptions

Defined in:
lib/davinci_pas_test_kit/generator/descriptions.rb

Class Method Summary collapse

Class Method Details



28
29
30
31
32
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 28

def bundle_profile_link(operation, type, ig_version)
  "[#{PASConstants.bundle_profile_name_for_operation_and_type(operation, type)}]" \
    "(#{profile_url_to_link(PASConstants.bundle_profile_url_for_operation_and_type(operation, type),
                            ig_version)})"
end

.bundle_validation_test_description(operation, type, ig_version) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 51

def bundle_validation_test_description(operation, type, ig_version)
  <<~DESCRIPTION
    #{"#{description_user_input_validation}\n" if type == 'request'}This test validates the conformity of the
    #{type == 'request' ? 'user input' : "server's response"} to the
    #{bundle_profile_link(operation, type, ig_version)}
    profile#{type == 'request' ? ', ensuring subsequent tests can accurately simulate content.' : '.'}

    It also checks that other conformance requirements defined in the [PAS Formal
    Specification](https://hl7.org/fhir/us/davinci-pas/#{ig_version_for_link(ig_version)}/specification.html),
    such as the presence of all referenced instances within the bundle and the
    conformance of those instances to the appropriate profiles, are met.

    It verifies the presence of mandatory elements and that elements with
    required bindings contain appropriate values. CodeableConcept element
    bindings will fail if none of their codings have a code/system belonging
    to the bound ValueSet. Quantity, Coding, and code element bindings will
    fail if their code/system are not found in the valueset.

    Note that because X12 value sets are not public, elements bound to value
    sets containing X12 codes are not validated.#{"\n\n#{description_extension_limitations}" if ig_version == 'v2.0.1'}
  DESCRIPTION
end

.description_extension_limitationsObject



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 74

def description_extension_limitations
  <<~EXTENSION_LIMITATIONS
    **Limitations**

    Due to recognized errors in the PAS IG around extension context definitions,
    this test may not pass due to spurious errors of the form "The extension
    [extension url] is not allowed at this point". See [this
    issue](https://github.com/inferno-framework/davinci-pas-test-kit/issues/11)
    for additional details.
  EXTENSION_LIMITATIONS
end

.description_user_input_validationObject



86
87
88
89
90
91
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 86

def description_user_input_validation
  <<~USER_INPUT_INTRO
    **USER INPUT VALIDATION**: This test validates input provided by the user instead of the system under test.
    Errors encountered will be treated as a skip instead of a failure.
  USER_INPUT_INTRO
end


34
35
36
37
38
39
40
41
42
43
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 34

def ig_version_for_link(ig_version)
  case ig_version
  when 'v2.0.1'
    'STU2'
  when 'v2.2.1'
    '2.2.1'
  else
    raise "Implement link string for ig version #{ig_version}"
  end
end


21
22
23
24
25
26
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 21

def profile_links(profiles, ig_version, prefix: '')
  profiles.map do ||
    "#{prefix}- [#{.profile_name}](#{profile_url_to_link(.profile_url,
                                                                         ig_version)})"
  end
end


7
8
9
10
11
12
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 7

def profile_links_list(required_profiles, ig_version, request_profiles: nil)
  <<~DESCRIPTION
    #{profile_links(required_profiles, ig_version).join("\n")}
    #{request_profile_links_list(request_profiles, ig_version) if request_profiles.present?}
  DESCRIPTION
end


45
46
47
48
49
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 45

def profile_url_to_link(profile_url, ig_version)
  "#{profile_url.gsub('http:', 'https:')
    .gsub('davinci-pas/', "davinci-pas/#{ig_version_for_link(ig_version)}/")
    .gsub('StructureDefinition/', 'StructureDefinition-')}.html"
end


14
15
16
17
18
19
# File 'lib/davinci_pas_test_kit/generator/descriptions.rb', line 14

def request_profile_links_list(request_profiles, ig_version)
  <<~DESCRIPTION
    - At least one of the following request profiles
    #{profile_links(request_profiles, ig_version, prefix: '  ').join("\n")}
  DESCRIPTION
end