Closed mjwestgate closed 1 year ago
Decision 2022-02-08 to action this, with a caveat that the whole search_
and show_all_
syntax is a little clumsy and may need further thought.
On reflection, there is a further problem here. show_all_values
is actually nested wishing show_all_fields
, because show_all_values
requires a field
argument to return a sensible result. But this nestedness is obscured by giving both functions the same prefix. A similar problem occurs with show_all_profiles
and search_profile_attributes
. Species lists aren't implemented yet, but have the same issue again.
A better choice would be to separate out these 'nested' lookup functions into a new set of functions. Preliminary choice is:
show_field_values
(replacement for show_all_values
)show_profile_values
(replacement for search_profile_attributes
)show_list_values
(new function for species lists)Further discussion has led to a possible solution of show_values()
and search_values()
, with the above functions set as internal to to these 2 values
look-up functions. These can be piped from a search result of an accepted information type. For example:
search_all(fields, "cl22") |> show_values()
search_all(fields, "cl22") |> search_values("tasmania")
fixed with addition of show_values
and search_values
In v.1.4.0, we have
show_all_fields()
to show which fields are valid, andsearch_fields()
to run a search withinshow_all_fields
(viagrepl
). This is also used internally whengalah_config(run_checks = TRUE)
to ensure that user-supplied field names exist in the specified atlas. However, there is no equivalent for values within a field.Specifically,
search_field_values()
is conceptually closer toshow_all_fields
thansearch_fields
, because it returns all possible values for the specified field. Then the user must build their own search using the resultingtibble
to check if the specified value is present.Potentially improved behavior is:
show_all_values()
with a mandatoryfield
argument, basically the same as the currentsearch_field_values
search_values()
with argumentsfield
andstring
, to allow searching within a specified fieldA further benefit of this approach is that we could support value checking when
galah_config(run_checks = TRUE)
usingshow_all_values
, in the same way as we currently useshow_all_fields
.As an aside, default behaviour for
atlas_counts
is that settinglimit = NULL
returns all values, but this doesn't work forsearch_field_values
.