-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
…nerRole (#198) * pass current ref server * Run MustSupport test for each Practitioner * Look good now * Move PractitionerAddressTest module * rubocop * fix unit test issue * Call resource_is_valid_with_target_profile? * Update missing_must_support_message * Auto generate practitioner_address_test (#200) * auto generate practitioner_address_test for each allowed version * remove commented codes --------- Co-authored-by: Yunwei Wang <> --------- Co-authored-by: Yunwei Wang <>
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module USCoreTestKit | ||
class Generator | ||
class PractitionerAddressTestGenerator | ||
class << self | ||
def generate(ig_metadata, base_output_dir) | ||
ig_metadata.groups | ||
.reject { |group| SpecialCases.exclude_group? group } | ||
.each { |group| new(group, base_output_dir).generate } | ||
end | ||
end | ||
|
||
attr_accessor :group_metadata, :base_output_dir | ||
|
||
def initialize(group_metadata, base_output_dir) | ||
self.group_metadata = group_metadata | ||
self.base_output_dir = base_output_dir | ||
end | ||
|
||
def template | ||
@template ||= File.read(File.join(__dir__, 'templates', 'practitioner_address_test.rb.erb')) | ||
end | ||
|
||
def output | ||
@output ||= ERB.new(template).result(binding) | ||
end | ||
|
||
def base_output_file_name | ||
"#{class_name.underscore}.rb" | ||
end | ||
|
||
def output_file_directory | ||
File.join(base_output_dir, profile_identifier) | ||
end | ||
|
||
def output_file_name | ||
File.join(output_file_directory, base_output_file_name) | ||
end | ||
|
||
def profile_identifier | ||
Naming.snake_case_for_profile(group_metadata) | ||
end | ||
|
||
def test_id | ||
"us_core_#{group_metadata.reformatted_version}_practitioner_address_test" | ||
end | ||
|
||
def class_name | ||
"PractitionerAddressTest" | ||
end | ||
|
||
def module_name | ||
"USCore#{group_metadata.reformatted_version.upcase}" | ||
end | ||
|
||
def generate | ||
return unless group_metadata.resource == 'Practitioner' && group_metadata.version[1].to_i > 5 | ||
|
||
FileUtils.mkdir_p(output_file_directory) | ||
File.open(output_file_name, 'w') { |f| f.write(output) } | ||
|
||
group_metadata.add_test( | ||
id: test_id, | ||
file_name: base_output_file_name | ||
) | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require_relative '../../../practitioner_address_test' | ||
|
||
module USCoreTestKit | ||
module <%= module_name %> | ||
class <%= class_name %> < Inferno::Test | ||
include USCoreTestKit::PractitionerAddressTest | ||
|
||
title 'Server support either Practitioner.address or PractitionerRole' | ||
description %( | ||
US Core Responders SHALL support either US Core PractitionerRole Profile or | ||
these data elements in US Core Practitioner Profile | ||
|
||
* Practitioner.address | ||
* Practitioner.address.city | ||
* Practitioner.address.country | ||
* Practitioner.address.line | ||
* Practitioner.address.postalCode | ||
* Practitioner.address.state | ||
) | ||
|
||
id :<%= test_id %> | ||
|
||
def self.metadata | ||
@metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true)) | ||
end | ||
|
||
run do | ||
verify_practitioner_address | ||
end | ||
end | ||
end | ||
end |