Open REHarbach opened 2 years ago
This problem was reported by me two years ago, on 13 May 2020: Autotagging of taxon descriptions with terms from lexicon #6220 Morphological term autotagging is one of the most important features of Scratchpads.
ongoing analysis
I've linked that other issue based on your above comment. They may indeed be linked. My ongoing investigation in #6549 will eventually confirm.
This issue seems to be linked to the previous issue I submitted regarding the problem with illustrations not being displayed in the Anatomical Glossary.
https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6549
ongoing analysis
Can you show me which pages need to be linked please?
I think I have not explained the problem properly. It is not a matter of linking pages. Before myspecies, all of the morphological terms in all of the taxon pages were automatically liked to the definitions of the terms in the Anatomical Glossary. In the case of terms that should not be linked, e.g. Root as a surname as opposed to "root" in the list of Adult terminology, the term was enclosed in “[no-lexicon] … [/no-lexicon]”. It was my understanding that the ScratchPad software was configured to automatically make the links. Each time I added a new taxon page, the anatomical terms were automatically linked, indicated by highlight in blue. I then was able to identify terms that should not have been linked and I was able to block the link by enclosing the term within “[no-lexicon] … [/no-lexicon]”.
I thought the linking feature was common to all sites, but I now wonder if it was unique to my site. The original programmer for ScatchPads, Simon Rycroft, designed my sight, which has features that are not standard for ScratchPads.
I hope this will help to re-establish the links between anatomical terms in the taxon pages and those in the Anatomical Glossary.
Thank you for further consideration of this problem.
Ralph
Ralph E. Harbach
Scientific Associate
Natural History Museum
London SW7 5BD, UK
Tel. +44 (0)20 7942 5768
Fax. +44 (0)20 7942 2559
http://www.nhm.ac.uk/our-science/departments-and-staff/staff-directory/ralph-harbach.htmlhttp://www.nhm.ac.uk/research-curation/stall-directory/entomology/r-harbach/index.html
https://mosquito-taxonomic-inventory.myspecies.info/
From: therobyouknow @.> Sent: 29 July 2022 11:25 To: NaturalHistoryMuseum/scratchpads2 @.> Cc: Ralph Harbach @.>; Author @.> Subject: Re: [NaturalHistoryMuseum/scratchpads2] Morphological terms in taxon pages not linked to terms in the Anatomical Glossary [Related to #6220] (Issue #6550)
Can you show me which pages need to be linked please?
— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNaturalHistoryMuseum%2Fscratchpads2%2Fissues%2F6550%23issuecomment-1199116649&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7Cac56ca762cdd4b2cbf2108da714c9bda%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637946871084324275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2fMQRVVpFM%2BPjDJMv9r%2BayXoAY%2BBq4rVPT%2F2tzF53l4%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXCNV47EYHVZPQMHTETN2ADVWOWQFANCNFSM5WVQNT5A&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7Cac56ca762cdd4b2cbf2108da714c9bda%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637946871084324275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oF8WvhH76NqMatNYkrjXItk7LVub2uD%2Fgu7UKP4zwQE%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
ongoing analysis
Thank you @REHarbach
I'm very grateful for the further information. I certainly appreciate there's more to it than linking pages.
I can see that it is terms within these pages that need to be linked, rather than just the overall pages.
https://mosquito-taxonomic-inventory.myspecies.info/simpletaxonomy/term/6427 https://mosquito-taxonomic-inventory.myspecies.info/node/11027
Hi, Rob. The autotagging feature is common to all Scratchpads. Please read section "Semantic enrichment (tagging)" in: Smith, V.S., Rycroft, S.D., Harman, K.T. et al. Scratchpads: a data-publishing framework to build, share and manage information on the diversity of life. BMC Bioinformatics 10, S6 (2009). https://doi.org/10.1186/1471-2105-10-S14-S6 The Taxonomy Autotagger module can be found at https://www.drupal.org/project/autotag
How it is meant to work: A user creates a glossary (= lexicon) which, except for the more advanced taxonomy for scientific names, is essentially a Drupal taxonomy. The user enters terms "head" and "leg" in a glossary, e.g., a morphology glossary. Then the user creates taxon pages via the Taxon Description content type, and includes text describing head and leg features. If configured correctly, upon clicking on the TD save button, the autotagging will be triggered and call existing glossaries. If there is a word match, the word in the taxon page will be highlighted in blue and enriched with a link to the corresponding glossary term.
Manual configuration is done through a separate interface. See #6220 for partial description.
Tagging is partially working, what might be wrong is the configuration interface. It seems that some options have been lost. Testing in Myriatrix: The taxon description for Chilopoda already existed. I edited the description, section "Morphology", with the following text: "Body composed of head and trunk." See https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions The terms "body", "head", and "trunk" already existed in the "Morphology" lexicon/glossary. See https://myriatrix.myspecies.info/nontaxonomy/term/38678 Results: 1) Desired result not achieved. The words in section "Morphology" (https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions) are not highlighted and do not link to the "Morphology" glossary. 2) Undesired result: The words "body", "head", and "trunk" now appeared in the former blue banner Chilopoda, which now reads "Chilopoda, Body, Head, Trunk" in capital letters (see https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions). This is the natural result of an unnatural configuration. When configuring the Taxon Description content type via admin/structure/types/manage/spm -> Tag options, the "Field to populate " is a required field but only has one option: "Taxonomic name". Together with option "Append", the settings cause the undesired result in 2. Expected visual behavior: 1) The words should be highlighted in blue and directly linked to terms in the relevant glossaries. 2) Blue banners should not be affected by the "Field to populate " option. Either make it optional or add options that are invisible or can be configured for visibility.
Rob, please notify me when you are done inspecting what I wrote about Myriatrix. I will then change the settings or delete the text because I don't want the blue banner Chilopoda to be affected.
The AntKey Scratchpad used to be a flagship Scratchpad for illustrating how good taxon descriptions could be autotagged with morphological terms in a glossary. Until recently, that Scratchpad used to have a separate installation at AntKey.org, with the glossary terms correctly highlighted in taxon pages and the links to the glossary working. That site is now gone but I found https://antkey.myspecies.info which is mostly working but with the morphological glossary unreachable at http://antkey.org/lexicon/43 and the morphological terms not highlighted in taxon pages.
ongoing analysis
Thank you very much @Archilegt this information is most appreciated! It will certainly help in my analysis of how to fix. I will read through thoroughly and then advise my approach based on my updated understanding. Thank you again.
ongoing analysis
Rob, please notify me when you are done inspecting what I wrote about Myriatrix. I will then change the settings or delete the text because I don't want the blue banner Chilopoda to be affected.
Thank you @Archilegt I have captured screenshots of the pages you refer to for my own reference as I continue to look into this problem.
You can now change the settings back to how they were.
https://myriatrix.myspecies.info/node/1183/edit relates to https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions
also:
https://myriatrix.myspecies.info/nontaxonomy/term/38678
I've also re-read your comments and have an improved understanding of the issue as a result.
With that information I can now experiment with the settings on my personal setup and observe the results to help determine how to fix the problem.
ongoing analysis
https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1199269706
When configuring the Taxon Description content type via admin/structure/types/manage/spm -> Tag options, the "Field to populate *" is a required field but only has one option: "Taxonomic name".
Yes, observing that I also see this:
https://myriatrix.myspecies.info/admin/structure/types/manage/spm/auto_label
which is what you are referring to when you say "Tag options", I think. This is provided by https://www.drupal.org/project/autotag module you mentioned, I think.
[node:field_taxonomic_name]
Next steps are to see if there is scope on that page to adjust the configuration, to see if that helps fix the problem.
[node:field_taxonomic_name]
looks like a Drupal token and if so, there are many tokens supported.
ongoing analysis
Looking at tokens to see if we can select certain ones to help with solution.
For a full list of Tokens, go here:
https://myriatrix.myspecies.info/admin/help/token
(I have enabled the Help module to provide this facility)
then click on "Browse available tokens."
and you get:
Or direct URL:
I will experiment with this but I think there is potential for code changes required, including for the autokey module.
ongoing analysis
Antkey has the same configuration as https://myriatrix.myspecies.info/admin/structure/types/manage/spm/auto_label
See below:
https://antkey.myspecies.info/admin/structure/types/manage/spm/auto_label
Being the same and that @Archilegt you've said that Antkey was a good source of examples for tagging, I would think there is potentially a bug in the software that I would need to fix,
Some questions for you @Archilegt please:
Do you know when it stopped working?
Can you show me existing pages on https://myriatrix.myspecies.info where the tagging has worked?
ongoing analysis
Apologies @Archilegt by "tag options", I can now see you were referring to the vertical tab on the left on this page:
https://myriatrix.myspecies.info/admin/structure/types/manage/spm
When configuring the Taxon Description content type via admin/structure/types/manage/spm -> Tag options, the "Field to populate *" is a required field but only has one option: "Taxonomic name".
I had though that the "field to populate" - "taxonomic name" corresponded to the token set here: https://myriatrix.myspecies.info/admin/structure/types/manage/spm/auto_label - which is [node:field_taxonomic_name]
so I temporarily changed it on https://myriatrix.myspecies.info/admin/structure/types/manage/spm/auto_label to [node:field_morphology] to see if that field would then be available as a drop down below "field to populate", but not the case. My experimentation of the configuration there.
My previous 2 questions still apply, so let me know your replies to them.
dev notes
Meanwhile, I think I'm going to need to inspect and debug the code for https://myriatrix.myspecies.info/admin/structure/types/manage/spm/auto_label and its dependency https://www.drupal.org/project/tag modules
These modules are open sourced in the Drupal community contrib ecosystem, however they actually appear to exist in the Scratchpads codebase not as contrib modules but as custom modules:
auto_label
custom module in Scratchpads codebase appears to be the equivalent of autotag
contrib module~ actually auto_label
section of content type edit is provided by contrib module auto_entitylabel
Not sure if auto_entitylabel
contrib module is relevant for this issue - description of it says: "Allows hiding of entity label fields and automatic label creation."scratchpads_autotag
custom module equivalent of ?tagtag
custom module in Scratchpads codebase appears to be the equivalent of tag
contrib moduleComparing the equivalents (using Scootersoftware Beyond Compare) with their contrib modules shows some code differences. The impression so far I get from my visual inspection of the comparison is that the custom modules are newer in terms of functionality.
ongoing analysis, dev notes
I set xdebug some breakpoints in the above custom modules on my personal copy of the site, but break points not hit. So will try to choose some other ones, then I can inspect the variables and data to help my analysis as to why this issue is happening.
ongoing analysis, dev notes
Succinct summary of how it works in previous comment on this ticket further up:
https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1199217147
Next steps:
Once fixed, https://scratchpads.readthedocs.io/en/latest/index.html may need updating to include this feature, as I did not come across it in my use of this training.
ongoing analysis, dev notes
Followed the steps in https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1199217147
on personal local demo test training site:
created a biological taxonomy called fruit with terms orange, lime, lemon
created a Taxon Description node, expe
Saved.
noting message:
Biological terms must be added using the classification editor.
is that significant.
now to examine config and use xdebug and see also if there's info in this ticket and elsewhere about this used to work.
ongoing analysis, dev notes
A problem I can see is that the only field available in the Tag Options - presumably the configuration to populate to the tags into, is the title of the Taxon Description. The title field being field_taxonomic_name
.
If I reference term names in field_taxonomic_name
they don't get linked to the terms themselves, perhaps because that field is plain text being a title.
But also, the drop down options on Tag Options section (vertical tab) should offer other fields:
admin/structure/types/manage/spm
I thought adding options could be done here:
/admin/structure/types/manage/spm/auto_label
[node:field_taxonomic_name]
- Taxonomic Name
[node:field_general_description]
- General Description
But this didn't result in further fields offered to be populated in Tag Options
I can see that default drop down option for Tag Options field seems to be set here:
_scratchpads_autotag_save_defaults_for_node_type
in sites/all/modules/custom/scratchpads/scratchpads_autotag/scratchpads_autotag.module
Next steps would be to add further fields e.g. field_general_description
to see if they then appear in Tag Options on admin/structure/types/manage/spm
ongoing analysis, dev notes
Good morning. Continuing to work on this issue. Will now do the 'next steps' mentioned above.
ongoing analysis, dev notes
I've looked into this further to try to solve the issue.
I'll summarise what I understand the requirement is that is needed to be restored and then go on to comment on the situation with the Scratchpads software.
In summary, this issue is about the restoration of a facility to link words entered into a content field to taxonomy terms that have those names.
e.g.
1- You have a taxonomy fruit
with terms apple
, orange
, pear
.
2 - You create content of type Taxon Description
and during creation of the content, In one of the Long text
type fields (i.e. General Description
field (field_general_description
) or Morphology
field (field_morphology
), you write a sentence which includes one or more of the above terms, e.g. "I like fruit salad, especially when it has pear and orange".
3- Click save of your Taxon Description
content.
4 - Then, on viewing the content, you look for your "I like fruit salad, especially when it has pear and orange" sentence and observe that pear and orange each link to the page for their respective taxonomy terms.
Now, looking at the Scratchpads software. It looks like this facility has only been code developed Taxonomic Name
/ field_taxonomic_name
in Taxon Description
.
This field_taxonomic_name
field seems to behave like the title of the content which doesn't make sense to me as a field that would be parsed to embed links to terms in. Moreover the field type of this seemingly title field is a taxonomy term, rather than a text type field that would be parsed. So I am a bit puzzled as to what is going on here.
I also can't imagine how this facility could have ever worked if this is the only field apparently supported in the code.
I have come to the above conclusion by analysing _tagtag_fields_list
in tagtag.module
and scratchpads_taxonomic_name_field_tag_field_types_alter
in scratchpads_taxonomic_name_field
module.
I could try to add code to support for Long text
type fields such as field_general_description
and field_morphology
, which I will do. However, I note that there is an entire Drupal custom module dedicated to the field_taxonomic_name
: scratchpads_taxonomic_name_field
which concerns me that there is more to it than it seems in attempting to support these 2 additional fields.
I have some specific questions for the end users, which I will ask separately in a subsequent smaller comment below, so that they don't have to read all of the above technical analysis before asking my question.
questions for the end-users
@REHarbach @Archilegt
I have some questions for you:
ongoing analysis, dev notes
Just adding entries for the 2 fields didn't work I'm afraid.
I tried adding these 2 lines:...
$populate_fields['field_morphology'] = "Morphology";
$populate_fields['field_general_description'] = "General Description";
...after this existing line:...
$populate_fields = _tagtag_fields_list($form['#node_type']->type, 'populate');
in file sites/all/modules/custom/tagtag/tagtag.module
"Back to the drawing board" - I need to think further about how this works.
ongoing analysis, dev notes
2 things appear to be broken in the code which could be the root cause as to why the tagging is not working:
tag.api.php
but the module name is tagtag
. I suggest that the api hook implementation be renamed to tagtag.api.php
such that the name reflects the same name as its module, just like in other modules I've studied, e.g. views. I think that Drupal core will then recognise the API file.tag_on_save_tag_form_alter
is referred to in sites/all/modules/custom/tagtag/modules/tag_on_save/tag_on_save.module
but the function is not in the code base at all, from my searching. Therefore, I have some doubt that the tag_on_save_tag_update
could ever get called - that function launches another function tagtag_add_tags
which tags in the content as per this ticket requirement. xdebug breakpoints show this never gets called on saving Taxon Description content as would be required.Next steps: further xdebug debugging to confirm and testing. Then to formulate a possible solution and initially test.
ongoing analysis, dev notes
Following on from my analysis noted in my previous comment, mentioning missing and incorrectly name code, on the basis of this, I can't see how this functionality ever worked.
Therefore the outline of the solution is to add new code, that makes use of the Drupal core hook node save/update hook functions, instead of those currently. Those current seem to attempt the same thing - to launch the tagging code on a node save. This could be done with a standard hook save or update. I'll look into implementing this now, should be a small amount of code.
Recap on previous comment https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1199269706
Tagging is partially working, what might be wrong is the configuration interface. It seems that some options have been lost. Testing in Myriatrix: The taxon description for Chilopoda already existed. I edited the description, section "Morphology", with the following text: "Body composed of head and trunk." See https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions The terms "body", "head", and "trunk" already existed in the "Morphology" lexicon/glossary. See https://myriatrix.myspecies.info/nontaxonomy/term/38678 Results: 1) Desired result not achieved. The words in section "Morphology" (https://myriatrix.myspecies.info/taxonomy/term/7151/descriptions) are not highlighted and do not link to the "Morphology" glossary.
I now think that I may have missed another essential tagging feature. It seems that the Lexicon module may have built-in tagging features, but they seem not to be working either. Needs investigation.
What to investigate: In any site, try the path admin/config/system/lexicon
In the case of Myriatrix: https://myriatrix.myspecies.info/admin/config/system/lexicon
When prompted, see Lexicon Settings -> General settings -> checkbox Show/mark lexicon terms even if there is no description
. See also the explanatory text that appears when hovering over that option.
The checkbox was previously unchecked in Myriatrix. I checked it, saved, and then tried to edit and save the Pauropoda taxon description (https://myriatrix.myspecies.info/taxonomy/term/6570/descriptions), to see if the tagging would be forced upon save. Nothing happened, but I am inclined to believe that the checkbox and its code may be part of the answer we need, e.g., using a given lexicon to automatically tag (= mark?) words throughout the website.
See also Lexicon Settings -> Term marking settings -> checkbox Mark terms in content
. The drop-down menu Match type could also be tried, especially the option Any substring
.
I hope that this brings us closer to the answer!
ongoing analysis, dev notes
estimation for further work
3h
day and a half to implement - total 2 days.
Additional study material as in https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6595#issuecomment-1265287480
About the automatic taxon recognition in keywords: This is a feature that has been stable and it is working correctly as far as I know. It is doing what we are not managing other vocabularies to do: It brute-forces dictionary-based recognition of scientific names in the "Keywords" field and then takes those recognized terms and adds them as comma-separated values into the field "Taxonomic name". If we want other dictionaries and recognition routines to work, we need to provide output fields where the recognized terms can be added as cs values. I am just mentioning this here because the "Keyword" to "Taxonomic name" pair across Scratchpads represents the successful routine that we want to recreate.
ongoing analysis, dev notes
dev setup
Dev setup issues will impact my ability to work on this today, by up to a few hours. Hopefully they can be resolved asap by me.
ongoing analysis, dev notes
dev setup
switching to another machine for now to unblock myself, out of my 5 computers I have with me.
ongoing analysis, dev notes
dev setup
error on first machine was:
will have a look at this issue later.
These issues aren't to do with this issue but rather my setup. I'm logging them here for the record so I can give a reason as to why my response timescale is not as quick as I'd like.
ongoing analysis, dev notes
to check function not called - 1h
confirming tag_on_save_tag_update
in sites/all/modules/contrib/tag/modules/tag_on_save/tag_on_save.module
not called - breakpoint not hit in debugger. Also I inserted a die();
in the code too to be doubly sure.
Next, to look at the hook invoke to see if that code can 'see' the tag_on_save_tag_ui_info
which is a hook implementation that calls tag_on_save_tag_update
.
ongoing analysis, dev notes
remember where to look, assuming its in the tagtag api file, inspect the hook invoke, debug to see if it is seeing that function that's not being called - yes or no - it is or isn't being called - 2h
Analysing tag_form_node_type_form_alter
in sites/all/modules/contrib/tag/tag.module
ongoing analysis, dev notes
I looked into tag_form_node_type_form_alter
in sites/all/modules/contrib/tag/tag.module
which has a number of module_invoke_all
function calls, but breakpoint for first line of this function not being hit either, it would appear.
By the way I'm doing a node save where I expect this hook to be invoked.
ongoing analysis, dev notes
now, I'm getting somewhere. The other function I mentioned earlier is used in config, not a node save. This one below is one of those I think I should be looking at and it does indeed xdebug break on node save:
tag_form_alter
in sites/all/modules/contrib/tag/modules/tag_on_save/tag_on_save.module
Will continue to investigate.
ongoing analysis, dev notes
2 questions I have for myself for my analysis:
~1 - this line looks incorrect:
if(isset($form['#node_edit_form']) && $form['#node_edit_form']){
~
~The $form
array never contains that index id. according to what I observered with the xdebug breakpoints. The code inside the if never runs as a result. So we need to replace the index.~
~2 - what do we replace the index with. The debugger shows that there is a spm
content type in one of the form arrays that one of the calls to this function is made. We need something more generic I'd say which covers all content types where we want to have the word to tag insertion.~
To further re-affirm that this function needs work to fix, inside the if is: $search_services = module_invoke_all('tag_ui_info');
which should call a hook in tag_on_save
sub module that will then call the tag_on_save_tag_update
word to tag code.
update
Above 1 and 2 points incorrect. The if(isset($form['#node_edit_form']) && $form['#node_edit_form']){
does work. But one question I have now is when should this code run: when the form is being built or when it is submitted?
ongoing analysis, dev notes
ongoing analysis, dev notes
ongoing analysis, dev notes
ongoing analysis, question to scratchpad user
Additional study material as in https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6595#issuecomment-1265287480
About the automatic taxon recognition in keywords: This is a feature that has been stable and it is working correctly as far as I know. It is doing what we are not managing other vocabularies to do: It brute-forces dictionary-based recognition of scientific names in the "Keywords" field and then takes those recognized terms and adds them as comma-separated values into the field "Taxonomic name". If we want other dictionaries and recognition routines to work, we need to provide output fields where the recognized terms can be added as cs values. am just mentioning this here because the "Keyword" to "Taxonomic name" pair across Scratchpads represents the successful routine that we want to recreate.
Thank you @Archilegt for advising of this existing functionality. Here's a picture of what I think you have said:
Is this correct? Please show me an example of this on your site or someone elses.
And here is a picture of what I am fixing for this issue 6550 here:
Any comments let me know. Thank you!
ongoing analysis, dev notes
potential root cause as to why tagging words not working (this issue)
in function tag_submit_form
the index used for $search_services
array is not correct, because it is an index that doesn't exist in the array.
The $search_services
array contains the tagging code, having had module_invoke_all
which calls tag_on_save_tag_ui_info
Next steps:
I confess this is all gobbly-gook to me. I do not understand the two questions. As for replacement of "index", this brings to mind the word "lexicon" that was used before the site was moved to https and myspecies. What changed when the site was moved?
Ralph E. Harbach
Scientific Associate
Natural History Museum
London SW7 5BD, UK
Tel. +44 (0)20 7942 5768
Fax. +44 (0)20 7942 2559
http://www.nhm.ac.uk/our-science/departments-and-staff/staff-directory/ralph-harbach.htmlhttp://www.nhm.ac.uk/research-curation/stall-directory/entomology/r-harbach/index.html
https://mosquito-taxonomic-inventory.myspecies.info/
From: therobyouknow @.> Sent: 03 October 2022 15:50 To: NaturalHistoryMuseum/scratchpads2 @.> Cc: Ralph Harbach @.>; Mention @.> Subject: Re: [NaturalHistoryMuseum/scratchpads2] Morphological terms in taxon pages not linked to terms in the Anatomical Glossary [Related to #6220] (Issue #6550)
ongoing analysis, dev notes
2 questions I have for myself for my analysis:
1 - this line looks incorrect: if(isset($form['#node_edit_form']) && $form['#node_edit_form']){
The $form array never contains that index id. according to what I observered with the xdebug breakpoints. The code inside the if never runs as a result. So we need to replace the index.
2 - what do we replace the index with. The debugger shows that there is a spm content type in one of the form arrays that one of the calls to this function is made. We need something more generic I'd say which covers all content types where we want to have the word to tag insertion.
To further re-affirm that this function needs work to fix, inside the if is: $search_services = module_invoke_all('tag_ui_info'); which should call a hook in tag_on_save sub module that will then call the tag_on_save_tag_update word to tag code.
— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNaturalHistoryMuseum%2Fscratchpads2%2Fissues%2F6550%23issuecomment-1265582364&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C57ca88ab00fa42db008b08daa54e933f%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C638004054140686029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DiK2bP%2B8bqExhT4jsjYqzvzyvDlzjRbgaoKV0KMgv2c%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXCNV4YB52RS65T76VXZB7DWBLXCHANCNFSM5WVQNT5A&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C57ca88ab00fa42db008b08daa54e933f%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C638004054140686029%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IKcCenTN4vkOQlGmSmPMdhACrSBS6pXKKa2k9x9NAG8%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>
Don't worry Ralph! Apologies as the notes I'm making are technical. This is so it is the quickest for me to pick up from where I last left off, to share technical knowledge with other devs and my future self and to generally show that the issue is being worked on for your reassurance and for my bosses! :)
I always precede each technical comment entry with the heading title ongoing analysis, dev notes - when you see this please feel free to ignore the comment entry. If I have a question for the user like yourself, I'll indicate in the heading title.
Thank you!
potential fix on release sprint development branch rob/release-sprint-2022-10-03-2022-10-10
. Now to test.
ongoing analysis, dev notes
debug testing outcome - more coding work needed
tag_on_save_tag_form_alter
is the callback function name being constructed in tagtag_form_alter
, which doesn't exist in the code base.
But tag_on_save_tag_update
does exist which calls the tagtag_add_tags
function, but I haven't found anything that calls it yet, so it won't run.
ongoing analysis, dev notes
getting somewhere - this code below where the breakpoint is hit, is called on clicking save on a node.
The debugger shows the tag_on_save
tag_on_save_tag_update
function is present in the array.
But my past breakpoint sets on this function have shown it not to be called. So I will simplify this code to help me debug in smaller steps to see if I can pinpoint an issue.
ongoing analysis, dev notes
The code that adds the submit handler we need calling, isn't being called. My thinking is that there is an incorrect assumption being made about the construction of names to index into these arrays.
Re-doing https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1246836931 too see if we can get the fields to be populated.
Commit commit a715f73c330f7f7e0f68f45a803c40d19050f933 (HEAD -> rob/release-sprint-2022-10-03-2022-10-10, origin/rob/release-sprint-2022-10-03-2022-10-10)
results in:
So I'll select General Description, save and then re-save my node to see if it is populated as per https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1266720598
This hasn't worked. I can't spend any more time on this ticket.
The code seems to be more complicated than necessary to do: https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1266720598
And the config form in section 'Tag options' is not as straightforward as it should be:
/admin/structure/types/manage/spm
The form shows 3 fields: 1 - fields to search 2 - taxonomies 3 - fields to populate
If we're doing https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6550#issuecomment-1266720598 Why then do we need "1 - fields to search" . We only need the fields we want to link words in text to the tag "3 - fields to populate" iin the list above, and to know what tags to match with the text "2 - taxonomies" in the list above. And, no, we don't need to over engineer with UX just to make the form clearer.
So I'm pausing the work on this ticket for now because a) the form settings are not clear and appear to have additional information and don't explain why b) the code is overly complex and reasonable attempts at repair have not worked c) this has taken a large amount of time out of the sprint so I need to put time into other tickets
ongoing analysis, usage process understanding and dev notes
Updated understanding following study of custom module tagtag contrib module counterpart https://www.drupal.org/project/autotag:
This will need a new diagram from me to explain this. A picture paints...
Above understanding based on:
An additional option is provided on a content type configuration page
admin/structure/types/manage/page
admin/structure/types/manage/spm
specify which text fields should be searched for terms in specified vocabularies, and which field should then be populated with the results
This updated understanding has let me revisit the code to continue to troubleshoot the issue rather than consider a new module. Analysis and troubleshooting ongoing.
Ralph E. Harbach
Scientific Associate
Natural History Museum
London SW7 5BD, UK
Tel. +44 (0)20 7942 5768
Fax. +44 (0)20 7942 2559
http://www.nhm.ac.uk/our-science/departments-and-staff/staff-directory/ralph-harbach.htmlhttp://www.nhm.ac.uk/research-curation/stall-directory/entomology/r-harbach/index.html
https://mosquito-taxonomic-inventory.myspecies.info/
From: therobyouknow @.> Sent: 14 September 2022 12:23 To: NaturalHistoryMuseum/scratchpads2 @.> Cc: Ralph Harbach @.>; Mention @.> Subject: Re: [NaturalHistoryMuseum/scratchpads2] Morphological terms in taxon pages not linked to terms in the Anatomical Glossary [Related to #6220] (Issue #6550)
@REHarbachhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FREHarbach&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C19fa89e02b544729c83e08da96438a61%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637987514070831116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=rFpUSA93c6GdxPHKu1wojXiGgDgAbR%2FhFVXdBmUoSeE%3D&reserved=0 @Archilegthttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FArchilegt&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C19fa89e02b544729c83e08da96438a61%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637987514070831116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=M%2BcRCM5xyr5psuk4nZHMMQUKCGzogQbq1pa9%2B64SDV8%3D&reserved=0
I have some questions for you:
— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNaturalHistoryMuseum%2Fscratchpads2%2Fissues%2F6550%23issuecomment-1246622594&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C19fa89e02b544729c83e08da96438a61%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637987514070831116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Kdh%2BX%2BaKjLuM1u4NogfthTAQTM%2F6ofm7ig6LJVx9UiQ%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXCNV44XQINEHCWX6UFNPJTV6GYSXANCNFSM5WVQNT5A&data=05%7C01%7Cr.harbach%40nhm.ac.uk%7C19fa89e02b544729c83e08da96438a61%7C73a29c014e78437fa0d4c8553e1960c1%7C1%7C0%7C637987514070831116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GyrbFcJ706HxBbHo3j%2BcJ%2BcKMFPzmMhER%2FRAfkKwyfI%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>
Morphological terms in taxon pages are not linked to the terms in the Anatomical Glossary. Also, the identifiers [no-lexicon] and [/no-lexicon] are showing in the text where morphological terms are not supposed to be linked to terms in the glossary. This issue seems to be linked to the previous issue I submitted regarding the problem with illustrations not being displayed in the Anatomical Glossary. These problems apparently stem from the site being moved to https: and myspecies. If possible please have a look at the site before the transition to see the links between text and glossary. These links were automatically created by the software in the past.