PDS API Patient search using partial family name fails to return expected match

Using the PDS API against the INT environment, we have found that a wildcard search doesn’t return results that are known to be within the data.

Searching for a patient with these parameters:

{
  birthdate: '2011-05-09',
  gender: 'female',
  family: 'Shipperbottom'
}

returns a Bundle containing a single matched Patient resource.

Searching for a patient with a wildcard at the end of family:

{
  birthdate: '2011-05-09',
  gender: 'female',
  family: 'Shipper*'
}

returns a Bundle containing no matched Patient resources and no OperationOutcome resources.

We expected to get either a single matched Patient or a warning of multiple matches.

Similarly, searching for a patient with the start of the family:

{
  birthdate: '2011-05-09',
  gender: 'female',
  family: 'Shipper'
}

returns a Bundle containing no matched Patient resources and no OperationOutcome resources.

For FHIR R4 string parameters a “field matches a string query if the value of the field equals or starts with the supplied parameter value, after both have been normalized by case and combining characters”, with the example given that [base]/Patient?given=eve should match “Any patients with a name containing a given part with “eve” at the start of the name. This would include patients with the given name “Eve”, “Evelyn”.”

We expected to get either a single matched Patient or a warning of multiple matches.

Why does the service not find any match for these cases?

This is related to #226.
The first query gives back a patient with a mismatched date of birth based on the stale index mentioned there.
The second query is a wildcard search, not a simple search, and so does not use the stale index. Because the DOB doesn’t match the record, it’s not returned.
The third query again does not match on DOB.

1 Like

We’ve switched to a test patient that isn’t affected by the stale index problem and can now retrieve patients using partial family names using the wildcard. :+1:

We still don’t get an expected match when searching for the start of the family name:

{
  birthdate: '2011-01-28',
  gender: 'male',
  family: 'GILMA'
}

We expected the family parameter to match as per the FHIR R4 string parameter behaviour.

Why does the service not find a match for this case?

We can work round this relatively easily by appending the wildcard character to any string parameters.

On investigation, this is likely a bug.

I’ll raise a ticket to look at changing search so it behaves as documented, but in the meantime it would be advisable to do as you suggest and include the wildcard character where appropriate.

1 Like

Thanks!

Is there a way to track the ticket so that we know if/when it has been resolved?

NHS API Management team let me know that this fault has been added to the backlog as ticket SPINEDEM-1024 but it’s not expected to be resolved in the immediate future.