-
Notifications
You must be signed in to change notification settings - Fork 4
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
Multiple Species Labels #27
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The GUANO spec says that
Species Auto ID
andSpecies Manual ID
are a "list of strings".The serialized value should be comma-separated:
Species Manual ID: Mylu, Epfu
The Python library currently returns an
str
value, which in the above case would be"Mylu, Epfu"
.This means that library users would need to split it and strip it to know how many and which species labels were present.
It means that they might need to parse it and reassemble it in order to append a new value. (The spec doesn't actually state that values must be unique, but for most use cases that's probably desired.)
Therefore I think we should set up coercion/serialization for these Species fields so that they return a Python
list
, as follows:Species field not present:
md.get("Species Auto ID") -> None
and"species Auto ID" in md == false
Species field empty/blank:
md["Species Auto ID"] -> []
Species field has a single species label:
md["Species Auto ID"] -> ["Mylu"]
Species field has multiple species labels:
md["Species Auto ID"] -> ["Mylu", "Epfu"]
The spec defines these fields as
optional
, so the way to check whether a recording is a Mylu recording would be:if "Mylu" in md.get("Species Auto ID", []): ...
It would be cleaner and more intuitive if these two fields were
required
, butTimestamp
is the only required field at this time.Another approach to making it slightly cleaner would be adding explicit accessor methods for all of the well-known fields, where
in
could still check whether the field was present, anddef species_auto_id(self) -> list
would always return alist
, possibly empty.The text was updated successfully, but these errors were encountered: