Skip to content

Feature/36213/st georges crc importer new#81

Merged
NImeson merged 13 commits into
developfrom
feature/36213/st_georges_crc_importer_new
Jun 21, 2024
Merged

Feature/36213/st georges crc importer new#81
NImeson merged 13 commits into
developfrom
feature/36213/st_georges_crc_importer_new

Conversation

@NImeson

@NImeson NImeson commented Jun 10, 2024

Copy link
Copy Markdown
Collaborator

What?
A new St Georges importer has been written to account for a new data format (see planio ticket 36213).

Why?
A new importer had to be created to be able to parse St Georges colorectal data.

How?
The importer was written based on the rules sent by Fiona.

Testing?
Unittests have been written. A QA of the variant counts has also been completed and signed off by Fiona.

Note: git commit history for the work can be found in branch feature/36213/st_georges_crc_importer, this original branch was created from the 'main' branch in error, instead of the 'develop' branch. Code has been copied across to this new branch forked from 'develop'.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed?

@NImeson NImeson Jun 13, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed` in 075175e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can't see any test coverage for process_fields?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Test added 075175e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think you need to reassign genotype here, it's being mutated in the assign_test_scope method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed reassignment in 075175e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You won't need to return the genotype here if process_fields doesn't reassign genotype.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed

@ollietulloch ollietulloch Jun 10, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could assign DateTime.parse('18/07/2022') to a variable, rather than repeating the code snippet on L125.

The logic could be simplified, something like:

            date = DateTime.parse(record.raw_fields['authoriseddate'])
            panel_change_date = DateTime.parse('18/07/2022')
            genes = %w[APC BMPR1A EPCAM MLH1 MSH2 MSH6 MUTYH NTHL1 PMS2 POLD1 POLE PTEN SMAD4 STK11]

            date < panel_change_date ? genes : genes + %w[GREM1 RNF43]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

simplified logic here in 075175e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this could be simplified a little, something like:

            columns = if genotype.targeted?
                        ['gene', 'gene (other)', 'variant_dna', 'variant protein', 'test/panel']
                      elsif genotype.full_screen?
                        ['gene', 'gene (other)', 'variant_dna', 'test/panel']
                      end

            duplicate_genotype(columns, genotype, genes, record) if columns.present?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Simplified logic in 075175e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could the class name match the file name please? e.g. StGeorgeHandlerColorectalTest

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ammended in 075175e

@NImeson

NImeson commented Jun 10, 2024

Copy link
Copy Markdown
Collaborator Author

#77 (comment) - Take note of this comment for addition to CRC importer as well

Added logging method in CRC importer - should be ther in 075175e

@NImeson NImeson closed this Jun 13, 2024
@NImeson NImeson force-pushed the feature/36213/st_georges_crc_importer_new branch from a52f508 to 2e492af Compare June 13, 2024 11:44
@NImeson NImeson reopened this Jun 13, 2024
Comment thread lib/import/colorectal/providers/st_george/st_george_handler_colorectal.rb Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of assigning no genetic test scope, get it to give an error message, so we can flag if this ever happens and set new rules(see comment on code review for #77)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added logging method in CRC importer - should be there in 075175e

process_fields_wrecord = build_raw_record('pseudo_id1' => 'bob')
process_fields_wrecord.raw_fields['servicereportidentifier'] = 'W1234567'
@handler.process_fields(process_fields_wrecord)
assert_not_equal 'W1234567', @genotype.attribute_map['servicereportidentifier']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this would not be equal to the SRI even it was starting with 'V' , as process fields creates a new genotype

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changes made in d16287a

def interrogate_variant_protein_fullscreen(record, genotype, column)
if record.raw_fields['variant protein'].blank?
genotype.add_status(1)
elsif record.raw_fields['variant protein'].match(/fail/ix)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These are in a different order to the rules- can you check this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good spot, changes made in d16287a


def handle_test_status(record, genotype, genes)
columns = if genotype.targeted?
['gene', 'gene (other)', 'variant_dna', 'variant protein', 'test/panel']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think you need all these columns here? Probably a good idea to check these alongside the comment from @shilpigoeldev at line 70

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Corrected in latest commit

@shilpigoeldev

Copy link
Copy Markdown
Contributor

@NImeson , I don't think colorectal script to run 'RJ7' has been added yet , can you please commit that as well.

@NImeson

NImeson commented Jun 17, 2024

Copy link
Copy Markdown
Collaborator Author

@NImeson , I don't think colorectal script to run 'RJ7' has been added yet , can you please commit that as well.

Which file do you mean @shilpigoeldev ? the entry should be there in the bash script
.../Import_all_colorectal_interactive.sh. Is there another one missing?

@NImeson , Sorry , I missed that earlier..yes its present so nothing needed for this.

@NImeson NImeson marked this pull request as draft June 19, 2024 12:01
@NImeson NImeson marked this pull request as ready for review June 19, 2024 13:39
gene_list.each do |gene|
CRC_GENE_MAP[gene]&.each do |gene_value|
genes.append(gene_value)
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no need of CRC_GENE_MAP I suppose as we don't have any mapping being done here . In BRCA it was needed as BR1 -> BRCA1 but nothing needed here , so should get rid of it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is a common typo for MSH2 (MHS2) which is mapped back to MSH2, I think this is why I included it

# extracts panels tested from record
# map panels to list of genes in FULL_SCREEN_TESTS_MAP
# return list of genes tested in panel
panel_genes_list = FULL_SCREEN_TESTS_MAP[record.raw_fields['test/panel']]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you make this lookup as case insensitive like using downcase on record.raw_fields['test/panel'], as being done for adding scope?

@NImeson NImeson Jun 21, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is mapping the test panels (e.g. R209 etc) - should this be the same for BRCA also then? I think it is not lower case for BRCA

Comment thread lib/import/colorectal/providers/st_george/st_george_handler_colorectal.rb Outdated
@NImeson NImeson requested a review from shilpigoeldev June 21, 2024 11:30
shilpigoeldev
shilpigoeldev previously approved these changes Jun 21, 2024

@shilpigoeldev shilpigoeldev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All good !!

@NImeson NImeson requested a review from shilpigoeldev June 21, 2024 13:44
@NImeson NImeson merged commit 04d1357 into develop Jun 21, 2024
@NImeson NImeson deleted the feature/36213/st_georges_crc_importer_new branch June 21, 2024 14:11
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.

4 participants