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

Release #747

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Release #747

merged 2 commits into from
Apr 30, 2024

Conversation

vivbak
Copy link
Contributor

@vivbak vivbak commented Apr 30, 2024

Dear future Vivian, please for the love of god do not squash merge this PR.

illusional and others added 2 commits April 24, 2024 16:13
* Test that fails

* Add fix to check empty IN in the GenericFilters

* Linting

* Better logic for FilterModel.is_false

---------

Co-authored-by: Michael Franklin <[email protected]>
* In progress

* In progress

* Cohort GraphQL Skeleton -- functional now

* This should go in another PR

* ignore venv

* Updated docker mariadb setup instructions

* support for `name`, `derived_from` & other fields

* Fix error if applying `ord` to int

* Add all fields to model

* Set empty dict to fix GraphQL non-null error

* Fix error applying `ord` to int

* Add `name` to `cohort` table

* version bump

* Formatting; cohort GQL schema

* cohort layer update

* cohort db table update

* CohortBuilder route

* Single SG ID form

* SG ID from project(s) form

* Cohort Builder page

* Re-usable SG scrolling table

* types definition

* Add link to nav bar to cohort builder

* Add substring search

* Formatting; add assay filter on sample

* Allow hashable assay filter when `meta` present

* Type for project

* Add GQL query to project form

* Add GQL query to ID form

* Handle form submission

* Atomic transaction

* Put query params in POST body

* add APIError type

* Add TODO note; add loader to search button

* merge dupe sgs from search results

* Use auto-gen API; better error handling

* clean up imports

* Make inputs reactive

* Cohort detail view

* import updates

* add detail route

* use with router hooks

* exclude ids input

* navigate to new detail vie

* make project required

* Add space between muck and msg

* Get project info

* Convert ids to int to fix not found error

* cohort project resolver

* Update table rendering logic

* Update table rendering logic

* Add search result info in warning box

* Linter fixes

* formatting

* lint fix

* unused import

* Tmp fix for billing query inside NavBar

* Custom cohorts SG query optimisation (#630)

* add assay meta array to type

* Fix rendering issues; add column customisation

* add additional SG filters to GQL schema

* Mod SG SQL query to filter on assay meta and sg timestamps

* Add timestamp and assay field to SG model

* Add assayMeta to GQL fetch

* Use new optimised SG GQL query

* Lint fix

* Change dict value type to `Any`

* Formatting

* Only allow meta which is not `None`

* White space trim

* Add check that new sg is not archived

* remove `assay_meta` in favour of nested assay object

* Proceduraly add query joins as required

* remove `assay_meta` in favour of nested assay object; add more filters

* Options to convert/ignore specific fields in `to_sql`

* Handle case when `archived` is an `int`; removed fields

* Updated queries

* mypy/pylint fixes

* Add form inputs for remaining fields

* npm audit

* Remove log

* Trim and remove empty values

* Simplify cram/gvcf query

* Remove merging - not required

* Test addtional filters

* test new sg filters

* lint fix

* Change to optional bool

* mypy fix

* change to `assertEqual` for better debugging

* Fail fast if wrong type for `archived`

* Add assay meta to detail view

* update dbbase import

* Update to_sql signature to match superclass. An attempt at pleasing the linter

* Fix click overwriting param to None when not specified

* Create endpoint to create cohort from criteria - Project/s

* Fix query cohort, call connection directly

* Add further criteria to create_cohort_from_criteria endpoint
* Also deletes redundant create_cohort endpoint

* Fix the linter, import order, spaces, etc

* Remove AddFromIdListForm.tsx

* Delete AddFromIDListForm

* Delete custom cohorts UI elements

* Remove link to Cohort Builder from NavBar

* Remove link to custom cohorts page in routes

* Revert package-lock to main

* Handle SG ID exclusion in cohort creation

* Add cohort_template table

* Add create cohort template endpoint

* Fix linting issues including;

* Add basic support for cohort creation from template

* Support query template in graphql, including adding project column

* Handle cohort criteria and cohort template cases

* Handle Templates in the layer and table

* Add skeleton for create_custom_cohort script

* Add dry-run, refactor script to reduce args, fix bug that doesnt allow template to be specified

* Return rich ids in dry mode

* Return rich ids when dry-run is false too

* Add support for rich custom cohort IDs i.e. COHXXX

* Add initial basic create_cohort_from_criteria() tests

* Surely incorrect fix for `Field 'timestamp' doesn't have a default value`

* Fix failing tests, move cohort creation to after dry run exit

* Rename derived_from to template_id, in line with user feedback, to add clarity

* Refactor generating sg_filter, to make room for supporting more inputs

* Fix FK issue in project.xml, delete old, add new

* Handle Sample Type as Cohort Criteria

* D'oh, blackify those parentheses

* Add test case exercising template_id foreign key

* Remove debugging print

* Add tranche of tests that need some sample data

* Add cohort-related tables to SYSTEM VERSIONING and TABLES_ORDERED_BY_FK_DEPS

This is required so that testbase.py can clear them out successfully.

* Set audit_log_id when INSERTing into cohort tables

Add audit_log_id field to cohort_template; the others already have it.

* Create cohort rows with timestamp set to (localtime) now

* Further tests for individual CohortCriteria fields

* Validate projects on input for create_template

* Remove what I assume is an artefact from a merge mistake

* Add cohorts to analysis objects

Co-authored-by: John Marshall <[email protected]>

* Account for cohort_ids in test_get_analysis() test case

* Verify that create_cohort_template now validates projects

* Another test for an individual CohortCriteria field

* Add test exercising re-evaluation of a cohort template

* Add test using all CohortCriteria fields

Note that these operate as "AND". I hoped to add another sample
D/saliva/exome/long-read/ONT and use sg_ids_internal=[sgD],
excluded_sgs_internal=[self.sgA] to get [B, D]. However what
that actually selects is D-only AND short-read-only, hence
matches nothing.

* Update schema docs

* Combine project.xml entries

* Add human readable CTPL prefix to templates

* Fix incorrect call of lunh_compute instead of lunh_is_valid

* Combine John's project.xml entries into Vivian's

* Add sample-type to cohort builder, fix typos

* Return all the cohort details in builder

* Add function to query analyses by cohort

* Catch value error sooner when template ID is invalid

* return None instead of error

* Add tests exercising cohort queries

* Add test_query_cohort

* Cohort -> cohorts

* Fix indent

* Remove passing author to cohortlayer explicitly.

* Add type hints

* Rename clayer and cohortlayer to cohort_layer

* fix lint, author removed. Add newline

* Fix whitespace for linter

* template id should not be nullable

* Remove template_id, specify as strawberry field instead. Rename CohortTemplateModel to CohortTemplate.

* Fix CohortTemplateInternal object is not subscriptable

* Fix failing tests by modifying type hints, dict[str,str] -> CohortTemplateInternal

* Add project ID checks

* Raise ValueError instead of assertion, to ensure it is caught

* Remove author being explicitly passed, use one from connection

* Plural cohort, cohort_template fields

* map to dict later, pass model

* execute -> execute_many

* Fix type of id on Cohort model

* New model for creating cohorts, fix project missing bug, rename Cohort to CohortInternal, fix tests accordingly

* Fix lint, although interesting that my linter didnt catch it

* Fix type hint, cohort_ids should be int not str

* Fix create_analysis, so it can handle no sgs as inputs

* Create two where_strs, remove unused import

* Remove sgs from cohortinternal model!

* Add strict param to id transform function

* redundant, no? remove a type check that already happened above

* Add typing to function, raise value error if template nor projects provided

* Fetch assay external ids too

* Move escape_like_terms to utils, apply to contains filter

* Implement Internal and External models for all objects. Move transform rich to raw,  to be on the route. Handle raw ids only from layers onward. Update tests accordingly

* Use UTC for test_query_with_creation_date comparisons

The creation time of the record inserted by upsert_sample() will
be reported in UTC, so we need to compare against today in UTC.
Otherwise tests fail when run locally before lunchtimeish as it
is still "yesterday" in UTC, so lt=today unexpectedly returns
the just-created record.

* Add basic tests for scripts/create_custom_cohort.py

Fix the script's template_id type, reflecting CohortBody's corresponding
member's change from str to int in d705285.

* Add separate CohortCriteria/Template.to_internal() tests

And in all the other tests, use CohortCriteriaInternal directly.

* Switch get_project_write_connection to get_project_readonly_connection as noone will be able to use it at present

* Return [] if no template meets criteria, switch return order of project and templates

* Cohort ID should be None in dry-run mode

* sample_types -> sample_type

* Only run _query_cohort_ids query if :analysis_ids will be non-empty

* Improve mocking in test_cohort_builder.py tests

Actually call the underlying route so real data can be returned.

In create_custom_cohort.py, add a return value for ease of testing and
fix get_cohort_spec() type annotations.

* Escape metacharacters in icontains query string (and add tests)

* Make --dry-run an argumentless flag option

* Bump version: 6.9.1 → 6.10.0

---------

Co-authored-by: Daniel Esposito <[email protected]>
Co-authored-by: John Marshall <[email protected]>
Co-authored-by: John Marshall <[email protected]>
@vivbak vivbak requested a review from illusional April 30, 2024 03:33
@vivbak vivbak merged commit de7e78c into main Apr 30, 2024
6 checks passed
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