One of our users had an issue where their entire instance became virtually unusable because PT was timing out when communicating with the Monarch specificity scorer. Because the scorer is queried in a controller on every patient record save, it became almost impossible to use the instance.
Can we please consider the following changes to make the scorer service more robust?
Prevent the score from being recalculated on every patient save. Only recalculate the specificity score in case it needs to be recalculated.
Set the timeout for querying the monarch service to be very small, something like 1 second.
What you requested was already implemented:
there's a cache which prevents useless requests for the same phenotype combination
there's a 2 seconds timeout while waiting for data
I also added a 1 second timeout for establishing the socket connection, which is where I noticed real slowdowns when blocked by a firewall.