Improve format and element sniffing #171
Merged
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.
Improve format sniffing and implement element sniffing for JSON and YAML.
The PR adds a bug fix for the simple format sniffing. The format sniffing algorithm first checks if the input looks like YAML or JSON file and falls back to Protobuf if not.
The element sniffing works for JSON and YAML formats. In JSON, the algorithm determines the element using discriminatory top-level fields; the field names that are unique to
Phenopacket
(e.g.subject
),Family
(e.g.pedigree
) andCohort
(e.g.members
). An exception is thrown if the available content does not contain a discriminatory field or in presence of fields from different top-level components.Element sniffing does not work for Protobuf at the moment.