[misc] Refactor the SimilarCases extension to allow other possible sources of similar patients