Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This module provides functionality to build a hierarchical biological taxonomy sourced from the ITIS database (http://www.itis.gov/downloads/).
- PHP PDO Sqlite Module
- Batch API
- Libraries
- Entity
As with all hierarchical taxonomy trees, a module such as taxonomy_manager is recommended for use in managing the resultant vocabulary.
Installation
- This module requires PDO SQLite (3.x or above) be installed.
- Before enabling the module, download the Full ITIS Data Set SQLite database (http://www.itis.gov/downloads/) and extract the ITIS.sqlite file into /sites/all/libraries/itis/.
- Enable the module and browse to admin/config/biological_taxonomy/build.
Important Links
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/JacobSanford/2510054.git biological_taxonomy
Comments
Comment #1
JacobSanfordComment #2
JacobSanfordComment #3
JacobSanfordPlease note: the parreview failure (regarding the short and cryptic function name) is to reduce memory from the potentially huge operations array that a large batch taxonomy import generates.
Comment #4
PA robot CreditAttribution: PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #5
das.gautam CreditAttribution: das.gautam commentedHi,
Some points before i review this further:
1) You have used get_t() in hook_menu generaly this is used in hook_schema , hook_requirement or hook_update as per the database access standard.Please make sure you require it.
2)Read you project page still it is recommended to use hook_help to make users understand your module.
3)A documentation of variables used in below function would be good:
indices.inc
Comment #6
JacobSanfordThanks for the review! I appreciate it.
I have implemented all changes as recommended.
Comment #7
riccardino CreditAttribution: riccardino commentedHello,
I'm revising your module but I cannot manage to do it work on a clean drupal installation as I get it from GIT.
It seems there are a couple of mistake:
file "biological_taxonomy.module", line 19
'page callback' is invalid because you do not specify the 'file' the callback function is in. I think you should ad this code line
'file' => 'system.admin.inc',
In the $items['admin/config/biological_taxonomy'] array definition.
file "Includes/batch/indices.inc" line 45
A function named '_bt_index_add' is not defined and cannot be declared as a callback_batch_operation() implementation. I think the line should be:
'_biological_taxonomy_index_add',
Comment #8
JacobSanfordThanks for the review! I appreciate it. Apologies for the errors, I implemented a refactor between the last review and yours, and obviously missed some functions.
I have implemented all changes as recommended.
JS
Comment #9
ajalan065 CreditAttribution: ajalan065 as a volunteer and at Innoraft commentedHi JacobSanford,
* 1. There are certain unnecessary variables in *.install file. $itis_download_url, $itis_donwload_files, $itis_target_html which have no such specific purpose.You have only used them once, so these can directly be replaced in-place.
+ 2. Do not use hardcoded path as you have done in
$itis_target_html = '/sites/all/libraries/itis/';
. Users should not be bound to keep the files in sites/all only. Use libraries_get_path() instead. Same as the case with thisvariable_set('biological_taxonomy_sqlite_path', DRUPAL_ROOT . '/sites/all/libraries/itis/ITIS.sqlite');
Also change it accordingly in other files as well.* 3. Extra blank line(line 53) in *.module file
* 4. In your project page as well as README.md, please include the line that the users require PDO SQLite (3.x or above) for the module to run correctly. As the normal PHP installation does not have this requirement pre-installed.
+ 5. It is highly discouraged to use direct database instructions as you have done in db.inc.
Sample snippet from your code
$get_kingdoms_query = "SELECT tsn, complete_name FROM taxonomic_units WHERE parent_tsn=0 AND (n_usage='accepted' OR n_usage='valid')";
Use db_query() instead.
+ 6. There has been multiple usage of the code drupal_get_path('module', 'biological_taxonomy') in indices.inc
Save it in a constance instead and use it all places. For eg:
define(BIOLOGICAL_TAXONOMY, drupal_get_path('module', 'biological_taxonomy'));
* marked are petty problems, but + marked are fairly good issues with your project. Have a look at it and sort things out.
Comment #10
JacobSanfordComment #11
JacobSanfordHI ajalan065,
Thanks so much for your review. I sincerely appreciate it.
I've made the changes you recommended in all items, except #5. Please see below for some notes:
2. I have changed all uses of this except those in README files, or hook_install warnings where you cannot be assured the library exists (or is loaded).
5. From my perspective, all uses of the PDO direct database calls in the module are related to the SQLITE database, not the Drupal database. AFAIK, it isn't possible to query non-Drupal databases through db_query(), since there isn't a DB handle argument.
Warm regards,
Jake
Comment #12
Welsby CreditAttribution: Welsby as a volunteer commentedHeya,
I notice you have a private function (_bt_4dd) - it might be a good idea to prefix this with the module name to avoid clashes.
Comment #13
JacobSanfordHi Welsby,
Thanks for the feedback. I did consider this, but as noted on:
http://cgit.drupalcode.org/sandbox-JacobSanford-2510054/tree/includes/ba...
The name is purposeful and chosen to save memory. The batch import can be hundreds of thousands of items, and I found that the callback function name length was directly correlated with the memory required. I attempted to generate a short-but-unique string that would be unlikely to ever clash.
If you had an alternate suggestion or workaround, I would love to hear it!
Regards,
Jake
Comment #14
aryashreep CreditAttribution: aryashreep as a volunteer commentedThere is some coding standard errors to fix :
Review of the 7.x-1.x branch (commit 4676088):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Source: http://pareview.sh/ - PAReview.sh online service
Comment #15
klausiThe author has already said why the function has this name. Please do not post automated reviews blindly :-(
Comment #16
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri at Azri Solutions commentedIgnore the function _bt_4dd. Please fix the remaining
Review of the 7.x-1.x branch (commit 4676088):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Comment #17
JacobSanfordHi Sri, thanks for the review. I'm happy to fix any issues that arise.
As a funny note : this project has been in review so long the standards file driving ParReview has changed several times.
Comment #18
djalxs CreditAttribution: djalxs as a volunteer and commentedIf the project review guide is actually read, some of you guys will find that these issues are non-blocking issues.
The code standard is not perfect but as stated in the guide, if the project maintainer has demonstrated use of the coding standards however there are a couple of issues, this is not a reason to block the module from promotion.
I have tested this module and everything is functional so I feel that if this should now be reviewed and tested by the community.
Comment #19
djalxs CreditAttribution: djalxs as a volunteer and commentedComment #20
visabhishek CreditAttribution: visabhishek as a volunteer and at Azri Solutions commentedHi JacobSanford,
My Findings are :
1: Never concatenate data directly into SQL queries
$get_kingdom_id_query = "SELECT tsn FROM taxonomic_units WHERE kingdom_id = '$kingdom_tinyint_id' AND rank_id<='$bottom_limit_selected' $filter_valid_accepted ORDER BY rank_id ASC";
AND
$get_kingdom_id_query = "SELECT kingdom_id FROM kingdoms WHERE kingdom_name='$kingdom_name'";
$get_term_query = "SELECT tsn, complete_name, parent_tsn, rank_id FROM taxonomic_units WHERE tsn='$tsn'";
See : https://www.drupal.org/docs/7/security/writing-secure-code/overview
2: Please keep tablename in curly brackets , Otherwise it will give error when table_prefix is used in system
example
$get_kingdoms_query = "SELECT count(*) FROM kingdoms";
3: All user facing text should be passed through t().
return '<p>There is a problem with the ITIS database file. See the '
Comment #21
PA robot CreditAttribution: PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.