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

Handle dynamic properties #105

Open
nickynicolson opened this issue Feb 6, 2024 · 1 comment
Open

Handle dynamic properties #105

nickynicolson opened this issue Feb 6, 2024 · 1 comment

Comments

@nickynicolson
Copy link

The DWCA standard supports "dynamic properties" which enable the mobilisation of "additional measurements, facts, characteristics, or assertions about the record": https://dwc.tdwg.org/terms/#dwc:dynamicProperties
This feature request is perhaps connected to issue #76 (assigning of column types) but could these properties (which are recommended to be supplied in key value format) be handled by dwca reader?

@niconoe
Copy link
Member

niconoe commented Feb 8, 2024

Thanks for the question/remark, @nickynicolson!

I haven't tested, but we should already be able to access the content of this field like any other one, with something like:

dynamic_properties = row.data["http://rs.tdwg.org/dwc/terms/dynamicProperties"]

The dynamic_properties will then contains the data as a simple Python string, that would need further processing by your code.

Full example, if the data contains JSON, as suggested by TDWG:

dynamic_properties_str = row.data["http://rs.tdwg.org/dwc/terms/dynamicProperties"]
dynamic_properties = json.loads(dynamic_properties_str)

In theory, python-dwca-reader could help its users by doing the json.loads() behind the scenes, but I am nor really in favor, because:

  • That would indeed imply that https://dwc.tdwg.org/terms/#dwc:dynamicProperties is implemented first
  • What if another structured than JSON is used (it's only a suggestion according to TDWG)? That would need more and more fragile additions to python-dwca-reader, which is not great for the long-term maintenance.

Does that help? Thanks again for reaching out!

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

No branches or pull requests

2 participants