Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-202: Refactor Validation #57

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
1d0e5cf
breaking out validation
radamson May 24, 2019
b311206
linting
radamson Jun 25, 2019
422deec
refining type choice checking
radamson Jul 3, 2019
1f188c6
check way to many datatypes
radamson Jul 3, 2019
0632c99
check elements against their type
radamson Jul 5, 2019
0b92804
guard against datatype validation of elements without a type
radamson Jul 5, 2019
7c273af
add profile url to result
radamson Jul 10, 2019
4dc0216
refactoring element validators
radamson Jul 25, 2019
9d104fd
use registered element_validators
radamson Jul 25, 2019
8b16dd9
break out element retrieval
radamson Jul 25, 2019
9980542
update cardinality check
radamson Jul 25, 2019
58ba63a
update datatype check
radamson Jul 25, 2019
99a0985
update tests
radamson Jul 26, 2019
6a185cf
terminology tests
radamson Aug 1, 2019
319320e
terminology validation
radamson Aug 1, 2019
0dc5d28
keyword argument initialization of results
radamson Aug 1, 2019
6fd0b82
change is_successful to result. simplify and test terminology better
radamson Aug 2, 2019
f6d8ef4
rubocop and testing updates
radamson Aug 5, 2019
0c4c45f
test coverage use both minittest and rspec
radamson Aug 5, 2019
1924dad
updating tests for better coverage and make code climate happy
radamson Aug 5, 2019
eec1455
maxLength tests
radamson Aug 5, 2019
5dcaf1d
trying to make code-climate understand
radamson Aug 5, 2019
61b9c40
code climate update needs to downgrade codecov
radamson Aug 5, 2019
f4ebee7
update cardinality to pass fail
radamson Aug 6, 2019
cf84d06
cleanup and appease rubocop
radamson Aug 6, 2019
e2cd931
structured results
radamson Aug 7, 2019
f124d29
update retrieval
radamson Aug 7, 2019
c81b750
address retrieval side effect
radamson Aug 7, 2019
43cefc5
test terminology validator registration
radamson Aug 7, 2019
a1d6059
add tests for terminology checks with a choice of types
radamson Aug 7, 2019
2a19614
add tests and remove some unused functions
radamson Aug 7, 2019
891d441
FHIR::Models use FHIR::Validation. fixes and updates for local_name …
radamson Aug 8, 2019
da7dc2e
StructureDefinition Validation use FHIR::Validator
radamson Aug 8, 2019
dfc197b
rename method
radamson Aug 8, 2019
6c8efdd
remove old validation code in element_definition
radamson Aug 8, 2019
6573838
update README
radamson Aug 9, 2019
7176391
break out method for getting type and resource definitions
radamson Aug 9, 2019
428b2e4
rename element_collection to elements in cardinality validator
radamson Aug 9, 2019
8fb70e3
add retrieve_elements_by_definition instance method to FHIR::Models
radamson Aug 9, 2019
00b0f56
add valid_cardinality? method to cardinality validation. add some mo…
radamson Aug 9, 2019
5fc7c39
use type_name
radamson Aug 9, 2019
0b3fbe0
add type_code method to FHIR::ElementDefinition
radamson Aug 9, 2019
fbefe1f
move result text into variable
radamson Aug 9, 2019
b669055
remove warnings for checking structure of primitive-types
radamson Aug 9, 2019
67035d2
data_type_validator map to each. more docs.
radamson Aug 9, 2019
ad58e9c
cardinality validator method docs update
radamson Aug 9, 2019
eab92ad
@vs_validators to vs_validators
radamson Aug 9, 2019
64f69c4
break up terminology validator
radamson Aug 12, 2019
2707ffc
fix_name to fixed_name
radamson Aug 12, 2019
90231aa
better variable names
radamson Aug 12, 2019
ba3ef46
add method for getting paths with type_code
radamson Aug 12, 2019
108069d
simplify type_code
radamson Aug 12, 2019
5046a59
simplifying retrieving by fhirpath
radamson Aug 12, 2019
0072541
breaking up retrieval...
radamson Aug 12, 2019
40e7a16
breakup indexing of elements
radamson Aug 12, 2019
1448469
break out parts of code checking. rename retrieve_type_choice_elemen…
radamson Aug 13, 2019
1fdcbd4
more refactoring
radamson Aug 13, 2019
631e489
breaking up the build_hierarchy method
radamson Aug 13, 2019
c048b66
breaking out parts of validate_hierarchy
radamson Aug 13, 2019
18a04aa
add method for executing element validators
radamson Aug 13, 2019
175feb5
more informative variable name
radamson Aug 13, 2019
15ff1e9
remove unnecessary spec
radamson Aug 13, 2019
ff1536f
Update spec/unit/validation/retrieval_spec.rb
radamson Aug 13, 2019
47c9c45
method for empty hierarchy node
radamson Aug 13, 2019
68577ab
dry out cardinality tests
radamson Aug 13, 2019
9060560
enable rubocop rspec checking
radamson Aug 13, 2019
658fa41
rubocop auto correct spec helper
radamson Aug 13, 2019
7ce7156
clean up cardinality validator tests
radamson Aug 13, 2019
c4cb6b2
clean up data type validator test
radamson Aug 13, 2019
10980dd
cleanup fixed_value_validator spec
radamson Aug 13, 2019
3bb46ef
cleanup max length validator spec
radamson Aug 13, 2019
884511b
more spec cleanup
radamson Aug 13, 2019
da597eb
simplify model spec
radamson Aug 13, 2019
1f9f4ca
cleanup structure validator test
radamson Aug 14, 2019
b411128
cleaning up terminology validator spec
radamson Aug 14, 2019
cfc1abb
minor updates and regenerate todo
radamson Aug 14, 2019
f2b0489
simplify terminology tests
radamson Aug 14, 2019
62f1e20
remove a few unnecessary tests from retrieval
radamson Aug 14, 2019
11d69c0
rename variable path_path to path_part
radamson Aug 15, 2019
a291c37
Fix validation of multiple types with latest US Core definitions.
jawalonoski Sep 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ tmp/

# User-specific
.idea

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
9 changes: 8 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require: rubocop-rspec
inherit_from: .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.4
Exclude:
- 'test/**/*'
- 'spec/**/*'
- 'lib/fhir_models/fhir/**/*'
- 'lib/fhir_models/fluentpath/evaluate.rb'
- 'lib/**/*.rake'
Expand All @@ -17,3 +17,10 @@ Style/FrozenStringLiteralComment:
inherit_mode:
merge:
- Exclude
Naming/RescuedExceptionsVariableName:
PreferredName: 'e'
RSpec/FilePath:
Enabled: false
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
130 changes: 95 additions & 35 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-04-22 22:20:52 -0400 using RuboCop version 0.67.0.
# on 2019-08-14 09:13:47 -0400 using RuboCop version 0.67.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 51
# Offense count: 40
# Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'lib/fhir_models/bootstrap/definitions.rb'
- 'lib/fhir_models/bootstrap/generator.rb'
- 'lib/fhir_models/bootstrap/hashable.rb'
- 'lib/fhir_models/bootstrap/model.rb'
- 'lib/fhir_models/bootstrap/preprocess.rb'
- 'lib/fhir_models/bootstrap/xml.rb'
- 'lib/fhir_models/deprecate.rb'
- 'lib/fhir_models/fhir_ext/element_definition.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
- 'lib/fhir_models/fluentpath/parse.rb'

Expand All @@ -35,53 +32,49 @@ Lint/ToJSON:
- 'lib/fhir_models/bootstrap/json.rb'
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'

# Offense count: 40
# Offense count: 34
Metrics/AbcSize:
Max: 392

# Offense count: 7
# Offense count: 5
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 74
Max: 68

# Offense count: 8
# Offense count: 1
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
Max: 5
Max: 4

# Offense count: 7
# Offense count: 6
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 354
Max: 269

# Offense count: 23
# Offense count: 16
Metrics/CyclomaticComplexity:
Max: 65

# Offense count: 44
# Offense count: 37
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 131
Max: 109

# Offense count: 2
# Offense count: 3
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 114

# Offense count: 23
# Offense count: 15
Metrics/PerceivedComplexity:
Max: 68

# Offense count: 5
# Offense count: 1
# Configuration parameters: PreferredName.
Naming/RescuedExceptionsVariableName:
Exclude:
- 'lib/fhir_models/bootstrap/hashable.rb'
- 'lib/fhir_models/bootstrap/json.rb'
- 'lib/fhir_models/bootstrap/xml.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'

# Offense count: 4
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
Expand All @@ -102,7 +95,81 @@ Performance/InefficientHashSearch:
Exclude:
- 'lib/fhir_models/bootstrap/template.rb'

# Offense count: 1
# Offense count: 31
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/lib/fhir_models/fhir_spec.rb'
- 'spec/unit/bootstrap/definitions_spec.rb'

# Offense count: 3
RSpec/DescribeClass:
Exclude:
- 'spec/lib/fhir_models/bootstrap/model_spec.rb'
- 'spec/lib/fhir_models/fhir_ext/structure_definition_spec.rb'
- 'spec/lib/fhir_models/fhir_spec.rb'

# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: SkipBlocks, EnforcedStyle.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'spec/unit/bootstrap/definitions_spec.rb'

# Offense count: 2
# Configuration parameters: CustomIncludeMethods.
RSpec/EmptyExampleGroup:
Exclude:
- 'spec/lib/fhir_models/fhir_ext/structure_definition_spec.rb'

# Offense count: 4
# Cop supports --auto-correct.
RSpec/EmptyLineAfterExampleGroup:
Exclude:
- 'spec/lib/fhir_models/fhir_spec.rb'

# Offense count: 31
# Cop supports --auto-correct.
RSpec/EmptyLineAfterFinalLet:
Exclude:
- 'spec/lib/fhir_models/fhir_spec.rb'

# Offense count: 6
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
- 'spec/lib/fhir_models/bootstrap/model_spec.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: CustomTransform, IgnoredWords.
RSpec/ExampleWording:
Exclude:
- 'spec/lib/fhir_models/bootstrap/model_spec.rb'

# Offense count: 5
# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 3

# Offense count: 121
# Configuration parameters: IgnoreSharedExamples.
RSpec/NamedSubject:
Exclude:
- 'spec/lib/fhir_models/fhir_spec.rb'

# Offense count: 28
RSpec/NestedGroups:
Max: 4

# Offense count: 2
RSpec/RepeatedDescription:
Exclude:
- 'spec/lib/fhir_models/fhir_spec.rb'

# Offense count: 25
# Configuration parameters: .
# SupportedStyles: inline, group
Style/AccessModifierDeclarations:
Expand All @@ -114,11 +181,10 @@ Style/ClassVars:
- 'lib/fhir_models/bootstrap/definitions.rb'
- 'lib/fhir_models/fluentpath/parse.rb'

# Offense count: 6
# Offense count: 4
Style/CommentedKeyword:
Exclude:
- 'lib/fhir_models/bootstrap/hashable.rb'
- 'lib/fhir_models/bootstrap/model.rb'

# Offense count: 14
Style/Documentation:
Expand All @@ -140,7 +206,7 @@ Style/Documentation:
- 'lib/fhir_models/fluentpath/expression.rb'
- 'lib/fhir_models/fluentpath/parse.rb'

# Offense count: 29
# Offense count: 24
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
Expand All @@ -149,7 +215,6 @@ Style/IfUnlessModifier:
- 'lib/fhir_models/bootstrap/model.rb'
- 'lib/fhir_models/bootstrap/template.rb'
- 'lib/fhir_models/bootstrap/xml.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'

# Offense count: 1
Expand All @@ -162,13 +227,11 @@ Style/MissingRespondToMissing:
Exclude:
- 'lib/fhir_models/bootstrap/model.rb'

# Offense count: 9
# Offense count: 4
Style/MultipleComparison:
Exclude:
- 'lib/fhir_models/bootstrap/definitions.rb'
- 'lib/fhir_models/bootstrap/generator.rb'
- 'lib/fhir_models/bootstrap/model.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'

# Offense count: 2
# Cop supports --auto-correct.
Expand All @@ -185,7 +248,7 @@ Style/OrAssignment:
Exclude:
- 'lib/fhir_models/bootstrap/generator.rb'

# Offense count: 16
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Expand All @@ -194,23 +257,20 @@ Style/RescueStandardError:
- 'lib/fhir_models/bootstrap/definitions.rb'
- 'lib/fhir_models/bootstrap/hashable.rb'
- 'lib/fhir_models/bootstrap/json.rb'
- 'lib/fhir_models/bootstrap/model.rb'
- 'lib/fhir_models/bootstrap/xml.rb'
- 'lib/fhir_models/fhir.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'
- 'lib/fhir_models/fluentpath/expression.rb'
- 'lib/fhir_models/fluentpath/parse.rb'

# Offense count: 6
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
# Whitelist: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/fhir_models/bootstrap/definitions.rb'
- 'lib/fhir_models/bootstrap/xml.rb'
- 'lib/fhir_models/fhir_ext/structure_definition.rb'

# Offense count: 7
# Cop supports --auto-correct.
Expand Down
10 changes: 7 additions & 3 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
require 'simplecov'
SimpleCov.command_name 'Unit Tests'
SimpleCov.command_name 'All Tests'
SimpleCov.start do
add_filter "test/"
add_group "Library", "lib"
add_filter 'test/'
add_filter '/spec/'
add_group 'Library', 'lib'
add_group 'Validation', 'lib/fhir_models/validation'
add_group 'FHIR Models', 'lib/fhir_models/fhir/resources'
add_group 'Generator Files', 'lib/fhir_models/bootstrap'
end

class SimpleCov::Formatter::QualityFormatter
Expand Down
13 changes: 8 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ GEM
ast (2.4.0)
bcp47 (0.3.3)
i18n
codeclimate-test-reporter (1.0.7)
simplecov
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.2)
concurrent-ruby (1.1.5)
coolline (0.5.0)
unicode_utils (~> 1.4)
date_time_precision (0.8.1)
diff-lcs (1.3)
docile (1.3.1)
docile (1.1.5)
ffi (1.10.0)
formatador (0.2.5)
guard (2.15.0)
Expand Down Expand Up @@ -100,11 +100,13 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.6)
rubocop-rspec (1.35.0)
rubocop (>= 0.60.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
shellany (0.0.1)
simplecov (0.16.1)
docile (~> 1.1)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
Expand All @@ -130,6 +132,7 @@ DEPENDENCIES
rake
rspec
rubocop (= 0.67)
rubocop-rspec
simplecov
test-unit

Expand Down
Loading