Skip to content

Issue 48298: Align API Filter Operators#60

Merged
labkey-adam merged 10 commits intodevelopfrom
fb_Issue48298
Sep 7, 2023
Merged

Issue 48298: Align API Filter Operators#60
labkey-adam merged 10 commits intodevelopfrom
fb_Issue48298

Conversation

@RosalineP
Copy link
Contributor

@RosalineP RosalineP commented Aug 16, 2023

Rationale

In the process of adding lineage filter operators to the APIs, I noticed a handful of inconsistencies I'm resolving across the APIs. See related pull requests.

Related Pull Requests

Changes

  • Update Changelog
  • Update comments
  • Add the following operators:
    • ONTOLOGY_IN_SUBTREE
    • ONTOLOGY_NOT_IN_SUBTREE
    • EXP_CHILD_OF
    • EXP_PARENT_OF
    • EXP_LINEAGE_OF

@RosalineP
Copy link
Contributor Author

RosalineP commented Aug 16, 2023

Manual Test Plan

  • Lineage Filter Operators

    • Go into a SM folder
    • Create a sample type with no manually added fields
    • Create three samples, accepting defaults. Choose one of them (say it's S-3) and click 'Aliquot Selected', choosing two Aliquots per Parent, and accepting defaults for aliquot creation
    • Go to /query-executeQuery.view?schemaName=sampleManagement&query.queryName=SourceSamples and add the LSID column
    • QueryFilter.Types.EXP_LINEAGE_OF:
      • Using the Java api, execute a selectRows against sampleManagement.SourceSamples, with a filter containing the components:
        • column: "lsid"
        • value: "{json:[<LSID of S-3>,10]}"
        • filter operator: EXP_LINEAGE_OF
      • Verify results:
        • S-3-1
        • S-3-2
    • QueryFilter.Types.EXP_CHILD_OF:
      • Using the Java api, execute a selectRows against samples.<Sample Type Name>, with a filter containing the components:
        • column: "lsid"
        • value: "<LSID of S-3>"
        • filter operator: EXP_CHILD_OF
      • Verify results:
        • S-3-2
        • S-3-1
    • QueryFilter.Types.EXP_PARENT_OF:
      • Using the Java api, execute a selectRows against samples.<Sample Type Name>, with a filter containing the components:
        • column: "lsid"
        • value: "<LSID of S-3-1>"
        • filter operator: EXP_PARENT_OF
      • Verify results:
        • S-3
  • Ontology Filter Operators

    • Load NCIT sample ontology from ontologies repo test/sampledata/ontology/owl/Thesaurus.owl/ncit.zip
    • Execute code like the following:
            SelectRowsCommand cmd = new SelectRowsCommand("ontology", "concepts");
            cmd.setColumns(Arrays.asList("Label", "Code", "Metadata", "Description", "OntologyId"));
            cmd.setFilters(List.of(new Filter("Code", "NCIT:C50367" /* Bed */, Filter.Operator.ONTOLOGY_IN_SUBTREE)));
            SelectRowsResponse response = cmd.execute(cn, "/Shared");
            System.out.println("Number of rows: " + response.getRowCount());
            response.getRows().stream().limit(10).forEach(System.out::println);
  • This should result in three rows, the parent "bed" concept plus its two children, "Specialty Bed" and "Scanner Patient Bed"
  • Replace ONTOLOGY_IN_SUBTREE with ONTOLOGY_NOT_IN_SUBTREE and it should indicate 160,423 rows (total rows 160,426 less the three "bed" concepts)

Copy link
Contributor

@labkey-adam labkey-adam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I'll do manual testing later today.

@labkey-adam
Copy link
Contributor

Manual testing complete. I added an example for the ontology filters to your comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants