-
Notifications
You must be signed in to change notification settings - Fork 0
Fixed silent data loss when parsing DCC documents #13
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
Open
HassanAkbar
wants to merge
5
commits into
main
Choose a base branch
from
fix/parse-data-loss
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4ffff61
stop dcc and d-si parsing from dropping data
HassanAkbar f0243da
require date explicitly in diff
HassanAkbar a3e4ed9
assert recovered quantity and value list counts
HassanAkbar d960228
merge main
HassanAkbar 74fa5a2
Round-trip NaN and reject infinities in decimal lists
HassanAkbar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "mml" | ||
|
|
||
| module Dcc | ||
| module Base | ||
| # `dcc:mathml` — a `dcc:xmlType` wrapper carrying a single foreign-namespace | ||
| # child, which for a formula is `ml:math`. The MathML tree hangs below the | ||
| # wrapper rather than replacing it. | ||
| module Mathml | ||
| # rubocop:disable Metrics/MethodLength -- one lutaml mapping block, | ||
| # split the same way every sibling module in Dcc::Base is written. | ||
| def self.included(klass) | ||
| klass.class_eval do | ||
| attribute :id, :string | ||
| attribute :ref_id, :string | ||
| attribute :ref_type, :string | ||
| attribute :math, ::Mml::V3::Math | ||
|
|
||
| xml do | ||
| namespace ::Dcc::Namespace::Dcc | ||
| element "mathml" | ||
| map_attribute "id", to: :id | ||
| map_attribute "refId", to: :ref_id | ||
| map_attribute "refType", to: :ref_type | ||
| map_element "math", to: :math | ||
| end | ||
| end | ||
| end | ||
| # rubocop:enable Metrics/MethodLength | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc | ||
| module Si | ||
| module Base | ||
| # `si:coverageIntervalType` — coverage interval stated directly on a real | ||
| # quantity, the sibling of `expandedUnc` in the same xs:choice. The v1 | ||
| # form; v2 keeps it as a deprecated alternative. | ||
| module CoverageInterval | ||
| # rubocop:disable Metrics/MethodLength -- one lutaml mapping | ||
| # block, written the same way as every sibling D-SI module. | ||
| def self.included(klass) | ||
| klass.class_eval do | ||
| attribute :standard_unc, :string | ||
| attribute :interval_min, :string | ||
| attribute :interval_max, :string | ||
| attribute :coverage_probability, :string | ||
| attribute :distribution, :string | ||
|
|
||
| xml do | ||
| namespace ::Dcc::Namespace::Si | ||
| element "coverageInterval" | ||
| ordered | ||
| map_element "standardUnc", to: :standard_unc | ||
| map_element "intervalMin", to: :interval_min | ||
| map_element "intervalMax", to: :interval_max | ||
| map_element "coverageProbability", to: :coverage_probability | ||
| map_element "distribution", to: :distribution | ||
| end | ||
| end | ||
| end | ||
| # rubocop:enable Metrics/MethodLength | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc | ||
| module Si | ||
| module Base | ||
| # `si:expandedUncType` — expanded uncertainty stated directly on a real | ||
| # quantity. The v1 form; v2 keeps it as a deprecated alternative to | ||
| # `measurementUncertaintyUnivariate`. | ||
| module ExpandedUnc | ||
| # rubocop:disable Metrics/MethodLength -- one lutaml mapping | ||
| # block, written the same way as every sibling D-SI module. | ||
| def self.included(klass) | ||
| klass.class_eval do | ||
| attribute :uncertainty, :string | ||
| attribute :coverage_factor, :string | ||
| attribute :coverage_probability, :string | ||
| attribute :distribution, :string | ||
|
|
||
| xml do | ||
| namespace ::Dcc::Namespace::Si | ||
| element "expandedUnc" | ||
| ordered | ||
| map_element "uncertainty", to: :uncertainty | ||
| map_element "coverageFactor", to: :coverage_factor | ||
| map_element "coverageProbability", to: :coverage_probability | ||
| map_element "distribution", to: :distribution | ||
| end | ||
| end | ||
| end | ||
| # rubocop:enable Metrics/MethodLength | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc::Si::V1 | ||
| class CoverageInterval < CommonElements | ||
| include ::Dcc::Si::Base::CoverageInterval | ||
| end | ||
| Configuration.register_model(CoverageInterval, id: :coverageInterval) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc::Si::V1 | ||
| # Deprecated v1 expandedUnc type — superseded by expandedMU in v2. | ||
| # Kept so old fixtures parse without losing data. | ||
| class ExpandedUnc < CommonElements | ||
| attribute :uncertainty, :string | ||
| attribute :coverage_factor, :string | ||
| attribute :coverage_probability, :string | ||
| attribute :distribution, :string | ||
|
|
||
| xml do | ||
| namespace ::Dcc::Namespace::Si | ||
| element "expandedUnc" | ||
| ordered | ||
| map_element "uncertainty", to: :uncertainty | ||
| map_element "coverageFactor", to: :coverage_factor | ||
| map_element "coverageProbability", to: :coverage_probability | ||
| map_element "distribution", to: :distribution | ||
| end | ||
| include ::Dcc::Si::Base::ExpandedUnc | ||
| end | ||
| Configuration.register_model(ExpandedUnc, id: :expandedUnc) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc::Si::V2 | ||
| class CoverageInterval < CommonElements | ||
| include ::Dcc::Si::Base::CoverageInterval | ||
| end | ||
| Configuration.register_model(CoverageInterval, id: :coverageInterval) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Dcc::Si::V2 | ||
| class ExpandedUnc < CommonElements | ||
| include ::Dcc::Si::Base::ExpandedUnc | ||
| end | ||
| Configuration.register_model(ExpandedUnc, id: :expandedUnc) | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.