-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
…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) |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 inorg.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 extendPhenoTipsPatient
and override methods so that they never actually save the underlyingXWikiDocument
, 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> |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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}
)
Do not merge, this PR is for convenience of monitoring changes only