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

Improve format and element sniffing #171

Merged
merged 6 commits into from
Apr 12, 2023

Conversation

ielis
Copy link
Collaborator

@ielis ielis commented Apr 5, 2023

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) and Cohort (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.

ielis added 4 commits April 5, 2023 12:49
Signed-off-by: Daniel Danis <daniel.gordon.danis@protonmail.com>
Signed-off-by: Daniel Danis <daniel.gordon.danis@protonmail.com>
Signed-off-by: Daniel Danis <daniel.gordon.danis@protonmail.com>
ielis added 2 commits April 5, 2023 17:05
…e codebase.

Signed-off-by: Daniel Danis <daniel.gordon.danis@protonmail.com>
Signed-off-by: Daniel Danis <daniel.gordon.danis@protonmail.com>
@ielis ielis merged commit f2488ff into phenopackets:develop Apr 12, 2023
@ielis ielis deleted the improve_format_and_element_sniffing branch April 12, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement element sniffing
1 participant