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

Enable creating Collection Object Relationships in Specify 7 #3120

Open
Tracked by #5312
grantfitzsimmons opened this issue Mar 8, 2023 · 5 comments · May be fixed by #5367
Open
Tracked by #5312

Enable creating Collection Object Relationships in Specify 7 #3120

grantfitzsimmons opened this issue Mar 8, 2023 · 5 comments · May be fixed by #5367
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system

Comments

@grantfitzsimmons
Copy link
Member

Currently there is this quite difficult and incomplete workaround:

https://discourse.specifysoftware.org/t/create-a-collection-relationship-in-specify-7/581

Collection relationships in Specify allow specimens to be associated with either specimens in another collection or with a taxonomic name in another collection. Some examples of these types of relationships are tissue and voucher, plant and pollinator and host parasite, etc. Specify allows collection objects in two different collections to be related to one another for the purpose of documenting these types of relationships. The collections may be in different disciplines.

Collection relationships require that one collection be the ‘Source’ and the other the ‘Destination’. In a single relationship, a source may have many destinations, but a destination may only have one source. This is important to remember when choosing which collection will be the source and which will be the destination. For instance, if a bee pollinates several flowers the bee collection would be the source and the flowers would be the destination.

At the database level:

Left Side: Source collection
Right Side: Destination collection

Collection relationships can either associate two collection objects (cataloged specimens) or a collection object from a source collection with a taxonomic name in a destination collection. A relationship that associates two collection objects is called an Object Relationship and a relationship that associates a collection object with a taxonomic name is called a Host Taxon ID.

Forms must be edited to include controls which allow the source collection object to be associated with the destination collection object or taxonomic name. Members may contact Specify at [email protected] to request forms that include either of these relationships.


Important Note: Currently, you must define a CollectionRelType view in your form definition to establish this in 7. You can expand the form definitions section to copy and paste the views used in this tutorial into your user's form definition.

[details="Form definitions:"]
Views:

        <view name="CollectionRelType"
            class="edu.ku.brc.specify.datamodel.CollectionRelType"
            resourcelabels="false">
            <desc><![CDATA[The CollectionRelType Form.]]></desc>
            <altviews>
                <altview name="CollectionRelType View" viewdef="CollectionRelType" mode="view" validated="false" default="true"/>                
                <altview name="CollectionRelType Edit" viewdef="CollectionRelType" mode="edit" validated="true"/>                
            </altviews>
        </view>

Viewdef:

        <viewdef
            type="form"
            name="CollectionRelType"
            class="edu.ku.brc.specify.datamodel.CollectionRelType"
            gettable="edu.ku.brc.af.ui.forms.DataGetterForObj"
            settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
            <desc><![CDATA[The Journal form - unknown use in schema]]></desc>

            <columnDef>100px,2px,195px,5px,86px,2px,210px,5px,74px,2px,146px,15px,p:g</columnDef>
            <columnDef os="lnx">115px,2px,195px,5px,125px,2px,210px,5px,125px,2px,131px,15px,p:g</columnDef>
            <columnDef os="mac">130px,2px,215px,5px,138px,2px,260px,5px,138px,2px,155px,15px,p:g</columnDef>
            <columnDef os="exp">p,2px,min(p;220px),5px:g,p,2px,p,5px:g,p,2px,200px,p,p:g</columnDef>
            <rowDef auto="true" cell="p" sep="2dlu"/>

            <rows>
                <row>
                    <cell type="label" labelfor="1"/>
                    <cell type="field" id="1" name="name" uitype="text"/>
                    <cell type="label" labelfor="2"/>
                    <cell type="field" id="2" name="remarks" uitype="text"/>
                </row>
                <row>
                    <cell type="label" labelfor="4"/>
                    <cell type="field" id="4" name="leftSideCollection" uitype="querycbx" initialize="name=Collection" isrequired="true" colspan="6"/>
                </row>
                <row>
                    <cell type="label" labelfor="5"/>
                    <cell type="field" id="5" name="rightSideCollection" uitype="querycbx" initialize="name=Collection" isrequired="true" colspan="6"/>
                </row>
            </rows>
        </viewdef>

[/details]

Step 1: Create a new Collection Relationship Type

You can do this by appending the following to your database's URL:

/specify/view/collectionreltype/new/

You need to give your new relationship a name (which will be used later) and select both the "left side" (source) collection and "right side" (destination) collection.

Collection Relationship Type form|690x253, 75%

Step 2: Add the relationship to your CO form.

In this instance, you can see that the relname= attribute is followed by the name we established in Step 1. In this case, relname="VoucherToTissue".

<cell type="field" id="colrel" uitype="plugin" name="this" initialize="name=CollectionRelOneToManyPlugin;relname=VoucherToTissue;" colspan="9"/>

Step 3: View the updated form and create a connection! You just need to press the "+" button on the new Collection Relationship view. You can then search for the catalog number of the related CO record.

image|642x500

@maxpatiiuk
Copy link
Member

maxpatiiuk commented Mar 8, 2023

Looks like the main task here is for us to modify the default view definition in sp6 (or better yet - add a mechanism for providing default forms in sp7 - we do have such capability front-end right now, but it's defined as XML right now - need to convert them back to XML using the syncer library)

@grantfitzsimmons
Copy link
Member Author

grantfitzsimmons commented Mar 8, 2023

This should have a custom UI in my opinion. The 6 implementation does and it is much more user-friendly than using the standard form system for it.

The query combo boxes for the collections don't work, so you have to use the search function and only sometimes does it work correctly. (No typesearch definition, no unscoped queries)

The UI would need to describe what's happening, where it can be used, and how the linkage works. None of that is clear now. It should let you just pick a collection as a source and pick a collection as a destination, then give it a name.

@grantfitzsimmons grantfitzsimmons added 2 - Forms Issues that are related to the form system and removed Unsorted labels Jul 2, 2023
@emenslin
Copy link
Collaborator

emenslin commented Aug 2, 2024

Can recreate in edge (7.9.6)

@grantfitzsimmons
Copy link
Member Author

This can be done when we finish #5312

@grantfitzsimmons
Copy link
Member Author

Fixed in 8d0522e

@grantfitzsimmons grantfitzsimmons linked a pull request Nov 6, 2024 that will close this issue
36 tasks
@grantfitzsimmons grantfitzsimmons linked a pull request Nov 7, 2024 that will close this issue
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants