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

Initial implementation of a stand-alone phenotype similarity scoring service #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

allasm
Copy link
Member

@allasm allasm commented Mar 18, 2019

Do not merge, this PR is for convenience of monitoring changes only

…service.

 - service is @ /rest/patients/matching-notification/compute-score
 - service accepts POST requests and has two POST parameters, `referencePatient` and `matchPatient` (both should be JSON strings in the Phenotips JSON format)
 - `referencePatient` and `matchPatient` are interchangeable
 - service only scores phenotypes, disorders and genes are ignored
* @return result JSON
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't really consume json, since it manually parses jsons from an x-www-form-encoded list of parameters.

this.slf4Jlogger.error("Can't convert JSON to a patient: [{}]", ex.getMessage());
return null;
}
final Patient patient = this.repository.create();
Copy link
Member

Choose a reason for hiding this comment

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

This actually creates a patient, so it is not suitable for use in production.

Some alternatives:

  • Make sure you delete the patient at the end (preferably skipping the document trash), although this will create some churn
  • Although using internal classes is discouraged, in this case it would be better to manually create a PhenoTipsPatient on a new XWikiDocument in a temporary space, and later delete that document
  • Implement the Patient interface like it's done in org.phenotips.data.script.PatientSpecificityScriptService.FakePatient, with no actual persistence and only implementing the methods the score cares about
  • Make that an actual public implementation, TransientPatientImpl that other services can use for temporary storage; it could extend PhenoTipsPatient and override methods so that they never actually save the underlying XWikiDocument, but otherwise it would behave just like a real patient

@@ -27,7 +27,7 @@
</parent>

<properties>
<coverage.instructionRatio>0.59</coverage.instructionRatio>
<coverage.instructionRatio>0.54</coverage.instructionRatio>
Copy link
Member

Choose a reason for hiding this comment

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

That's not good...

import javax.inject.Singleton;

/**
* For Arun.
Copy link
Member

Choose a reason for hiding this comment

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

Not good.

public interface PatientSimilarityScorer
{
/**
* Returns phenotype similarity score.
Copy link
Member

Choose a reason for hiding this comment

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

The name of the class suggests that this is a generic similarity scorer, not one that only looks at phenotypes. Either:

  • keep the API to return just a single score, but then modify the javadoc to be more generic, and write different implementations for different score aspects
  • modify the API to return more than one score, possibly as a map ({"phenotype":0.6, "genotype": 1.0, "disease":0,"overall":0.8})

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

Successfully merging this pull request may close these issues.

2 participants