Created
May 6, 2017 20:59
-
-
Save guyjacks/5ea632b5abca1d845456a2ee4c68f0f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_biopsy_rules(self): | |
| query = ''' | |
| with rule_set AS ( | |
| select rule_id AS id from mtx_biopsyrule where biopsy_id=3 | |
| ) | |
| SELECT | |
| biopsyrule.id AS id, | |
| biopsyrule.rule_id as rule_id, | |
| generule.mutated as mutated, | |
| gene.name as name | |
| FROM | |
| mtx_biopsyrule as biopsyrule | |
| INNER JOIN mtx_generule AS generule on biopsyrule.rule_id = generule.rule_id | |
| INNER JOIN mtx_gene AS gene ON generule.gene_id = gene.id | |
| WHERE | |
| biopsyrule.biopsy_id = 5 AND | |
| biopsyrule.rule_id in (select id from rule_set) | |
| import time | |
| from matchtx_api.mtx.models import Case | |
| start = time.time() | |
| case = Case.objects.get(pk=1) | |
| for rule in case.get_biopsy_rules(): | |
| print(rule.rule_id, rule.mutated, rule.name) | |
| stop = time.time() | |
| print ('done') | |
| print('took {0} seconds'.format((stop - start))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment