weecology / retriever

Quickly download, clean up, and install public datasets into a database management system
http://data-retriever.org
Other
306 stars 132 forks source link

Excessive script downloads caused by name-matching function #1063

Closed zhangcandrew closed 6 years ago

zhangcandrew commented 6 years ago

Right now there is a function called name_matches in engine_tools which helps users download scripts that are closely related to what they type in. I.e. if a user accidentally types retriever install csv iriis, the name_matches function should still download iris since it recognizes the user just made a simple error.

The problem we have right now is that if we type retriever install csv mapped-plant-quads-co and only want mapped-plant-quads-co, retriever installs mapped-plant-quads-co, mapped-plant-quads-ks, mapped-plant-quads-id, and mapped-plant-quads-mt due to the name matching function.

ethanwhite commented 6 years ago

My personal take is that we should match other package managers and:

  1. Only install if the names match exactly
  2. If the name doesn't match an existing dataset then check to see if there is something close using name_matches, tell the user that there is no dataset by that name, and return a "did you mean XXXX" message.
ss-is-master-chief commented 6 years ago

@ethanwhite @zhangcandrew Rather than having different packaged functions like install_csv, install_json, etc. would it be scalable to have just install as a command for the CLI, followed by the type? To avoid redundant downloads, the name-matching function could be modified as well. Something like this :

install --+
          |--- csv
          |--- json
          |--- xml
          |--- msaccess
          |--- postgres
          |--- sqlite
          |--- mysql
ethanwhite commented 6 years ago

@ss-is-master-chief - I don't understand the relationship between the install functions and the name matching in this issue, so this may be best discussed in a separate issue.

ethanwhite commented 6 years ago

Fixed in 8ad74192ce9ca1508452ff3dd6c1dfcf43cafab2