Giter Club home page Giter Club logo

patientmatcher's Introduction

patientMatcher - a Python and MongoDB - based MatchMaker Exchange server

Build Status - GitHub DOI

PatientMatcher is a Python (Flask) and MongoDB - based implementation of a MatchMaker Exchange (MME) server, developed and actively maintained by Clinical Genomics, Science For Life Laboratory in Stockholm. PatientMatcher is designed as a standalone application, but can easily communicate with external applications via REST API. The MME Stockholm node is being implemented in clinical production in collaboration with the Genomic Medicine Center Karolinska at the Karolinska University Hospital.

Info on how to test PatientMatcher or to set up a server containing an app frontend and backend is available on the documentation pages.

patientmatcher's People

Contributors

dependabot[bot] avatar northwestwitch avatar tsnowlan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

patientmatcher's Issues

Group match results by searched node

Not really a bug here, but it would add more useful info to the match objects.

Match objects saved to database now look like this:

matches = [
        {    # External match where test_patient is the query and with results
            '_id' : 'match_1',
            'has_matches' : True,
            'data' : {
                'patient' : {
                    'id' : 'P0000079',
                    'contact' : {
                        'href' : 'mailto:[email protected]'
                    }
                }
            },
            **'results' : [
                {'patient' : { 'patient_data' : 'test_stuff'}},
                {'patient' : { 'patient_data2' : 'test_stuff2'}},
            ],**
            **'searched_nodes' : [{ 'id': 'node1_id' , 'label': 'node1_label'}, { 'id': 'node2_id' , 'label': 'node2_label'}]**
            'match_type' : 'external'
        },
       ...
     ]

It would be nice to save matches like this instead:

matches = [
        {    # External match where test_patient is the query and with results
            '_id' : 'match_1',
            'has_matches' : True,
            'data' : {
                'patient' : {
                    'id' : 'P0000079',
                    'contact' : {
                        'href' : 'mailto:[email protected]'
                    }
                }
            },
            **'results' : [ {
                   'searched_node' : {{ 'id': 'node1_id' , 'label': 'node1_label'}},
                   'patients' : [{'patient' : { 'patient_data' : 'test_stuff'}}, {'patient' : { 'patient_data2' : 'test_stuff2'}}]
             },
             {
                   'searched_node' : {{ 'id': 'node2_id' , 'label': 'node2_label'}},
                   'patients' : [{'patient' : { 'patient_data3' : 'test_stuff'}} ]
            },
          ],**# end of results
            'match_type' : 'external'
        },
       ...
     ]

MatchMaker updated requirements n.2 --> Disclaimer!

New MME Service Requirements go into effect March 1.

Point n.7 :

For each database to which a MME service is connected by an API, the connected database’s disclaimers and terms should be posted on the MME service’s website and displayed with query results. Disclaimers can be found on GitHub (https://github.com/ga4gh/mme-apis). Disclaimers and terms may be returned with query results, which should supersede those found on the previously mentioned GitHub repository.

I'm still not sure what this means.

Fine-tuning of the SCORE_THRESHOLD param for Scout matching results

  • The current implementation of patientMatcher at Clinical Genomics returns the 5 patients most similar (with the highest patient score) to the patient used in the query.

  • Any patient with a patient score above 0 might be returned, and the patient might be returned even if it has an extremely low score, for instance due to genotype not matching at all and phenotypes quite far in the HPO hierarchy

  • Since it is better not to return any match then to send results with unspecific matches the SCORE_THRESHOLD should be fine-tuned. Action:

Return patients with a score compatible with at least a perfect gene (not variant) matching or an extremely similar phenotype to the query patient.

Current configs for patientMatcher @ CG:
MAX_GT_SCORE = 0.75
MAX_PHENO_SCORE = 0.25

Assuming that GT features are composed of 3 genes/variants, and assuming that there is gene matching for one of these features (1/4 of the max possible score) -->
0.75 / 3 (3 GT feature) / 4 --> 0.0625
with some phenotype similarity --> 0.08? 0.1?

0.0625 maybe to ensure that at least there is matching at the gene level (not variant).

Test on stage!

Add option to notify minimal or complete matching info by emails

For security reasons it's good to introduce an option to notify complete or partial info for MME matches by email.

I've changed the email body to follow the MME directives, see #65. Still it's good to have the option of NOT showing variants and phenotype terms of the matchings.

So add a config parameter that allows to show only contact info and cases ID in the notification emails.

Installing error due some dependency problems

  Running setup.py develop for patientMatcher
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

pytest-cov 2.10.1 requires pytest>=4.6, but you'll have pytest 4.4.1 which is incompatible.

Write code to capture indirect matches

For instance if an external node sends a query patient x and there are 3 matches on the database (a, b, c) then the matching result is saved already. Create a method that allows you to ask the server: are there external matches for patient b? And the server returns external patient x

Feedback from MyGene2

Make sure patientMatcher users are able to read email addresses from matches on other nodes

Scale-up simulation

Try to insert 5000 patients (100 times those 50 benchmarking patients) and see how the server behaves.

Capture HTML error messages from other nodes responses

So far ive assumed that server errors would also be returned a json but this is not universally valid because some node mighy return plain HTML, ad this causes a json parsing errror in the external matches handler. So do try to parse json but catch get html text as an option as well

Endpoints that should be reachable thru a firewall and endpoints to be used from within the server

Endpoints that should be reachable by external requests are:

  1. server_url/metrics (GET method)

  2. server_url/heartbeat (GET method)

  3. server_url/match (POST method) *

Endpoints that should be reached from within the same server:

  1. server_url/patient/add (POST method)

  2. server_url/patient/delete/<patient_id> (DELETE method)

  3. server_url/nodes (GET method)

  4. server_url/match (POST method) *

  5. server_url/match/external/<patient_id> (POST method)

  6. server_url/matches (GET method)

  • == endpoint which can be reached from the same server or by external request

MatchMaker updated requirements n.1 --> notification email should be exaustive

New MME Service Requirements go into effect March 1.

One of the updates is that:
If user receives a notification, the notification should include all information provided by the matching service or a direct link to additional available information.

This is relatively easy to fix. More info should be included in the match notification email

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.