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

add match_taxa wrap, fix env.yml #31

Merged
merged 7 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ repos:
exclude: ^src/

- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 6.1.0
hooks:
- id: flake8
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- geopandas
- pyworms
- ckanapi
- httpx
- plotly
- async
- requests
Expand Down
17 changes: 17 additions & 0 deletions pyobistools/taxa.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

from pyobistools.utils import removesuffix

from pyobistools.validation import check_scientificname_and_ids as check_names


STANDARD_SPECIES_COLUMNS = {
'taxon_id': np.nan,
'url': '',
Expand Down Expand Up @@ -94,6 +97,20 @@ def add_suffix(name: str) -> t.List[str]:
return [name.strip() + s for s in suffixes]


def match_taxa(names, ask=True, itis_usage=False):
"""
Wrap the existing functionality in validation in the expected name for this function as per R's iobis/obistools.

@param names List of scientific names to check against
@param ask Do we ask the user to resolve multi-match or ambiguous names?
@param itis_usage Pass through the ITIS check setting for the client function to handle

@return structure with appended lsids where WoRMS (or ITIS can resolve them)
"""

return check_names.check_scientificname_and_ids(names, value='names', itis_usage=itis_usage)


def search_worms(names: t.List[str],
kwargs: t.Dict[str, t.Any] = {}) -> pd.DataFrame:
"""
Expand Down
Loading