Smile CDR v2024.08.PRE
On this page:

6.9.1Phonetic Search Parameters

 

Search Parameters named "phonetic" (e.g. the "phonetic" search parameter on the Patient resource) are indexed using the METAPHONE encoder by default. This can be changed by setting Phonetic Encoder in the FHIR Storage Module to a different value. The available encoders are listed below.

Phonetic indexing can also be added to any SearchParameter of type "string". Use the extension http://hapifhir.io/fhir/StructureDefinition/searchparameter-phonetic-encoder to add a phonetic encoder to a SearchParameter. For example, you can create a Search Parameter with a Soundex encoder on Patient address line with the following SearchParameter definition.

{
 "resourceType": "SearchParameter",
  "extension": [ {
    "url": "http://hapifhir.io/fhir/StructureDefinition/searchparameter-phonetic-encoder",
    "valueString": "SOUNDEX"
  } ],
  "title": "Address Line Soundex",
  "status": "active",
  "code": "addressLineSoundex",
  "base": [ "Patient" ],
  "type": "string",
  "expression": "Patient.address.line"
}

This will Soundex encode all address lines before storing them to the index and perform the same encoding on incoming search parameters to match the stored Soundex encoded indexes. The following phonetic encodings are supported:

NB: Some phonetic encoders (METAPHONE and DOUBLE_METAPHONE) allow specifying a max character length for more accurate results. To do so, add the max character limit after the encoder value.

The following (partial) json illustrates how to specify a METAPHONE string encoder with a max character limit of 5.

{
 "resourceType": "SearchParameter",
  "extension": [ {
    "url": "http://hapifhir.io/fhir/StructureDefinition/searchparameter-phonetic-encoder",
    "valueString": "METAPHONE(5)"
  } ]
}
code Description Example
CAVERPHONE1 Apache Caverphone1 Gail = Gael, Gail != Gale, Thomas != Tom
CAVERPHONE2 Apache Caverphone2 Gail = Gael, Gail = Gale, Thomas != Tom
COLOGNE Apache Cologne Phonetic
DOUBLE_METAPHONE Apache Double Metaphone Dury = Durie, Allsop = Allsob, Smith != Schmidt
MATCH_RATING_APPROACH Apache Match Rating Approach Encoder
METAPHONE Apache Metaphone Dury = Durie, Allsop != Allsob, Smith != Schmidt
NYSIIS Apache Nysiis
REFINED_SOUNDEX Apache Refined Soundex
SOUNDEX Apache Soundex Jon = John, Thomas != Tom
NUMERIC Remove all non-numeric characters from the string before comparing. 4169671111 = (416) 967-1111