microsoft / microsoft/fhir-server

OR conditions not supported with comparator

Open
#815 1 comment 0 reactions 0 assignees View on GitHub
Area-Search Up for grabs
Dominant language
TSQL
Stars
1.4k
Forks
592
Avg merge
2d 7h
Merged PRs (30d)
41

Description

**Describe the bug**

It is not possible to search for dates with comparators, e.g. to exclude a date range.

**To Reproduce**
Steps to reproduce the behavior:
1. Spin up FHIR server, load synthea data
2. Search `/Patient?birthdate=ge1980-01-01,lt1970-01-01`, i.e. not the 70s.
3. Returns:
```
{
"resourceType": "OperationOutcome",
"id": "88972a44-e8f0-4773-97b4-b6780c2f5bff",
"issue": [
{
"severity": "error",
"code": "forbidden",
"diagnostics": "Comparator is not supported when multiple values are specified using OR search parameter."
}
]
}
```
**Expected behavior**

Should return all patients not born in the 70s.

**Actual behavior**

Rejects search.

**Additional information**

HAPI does not support this:

```
GET http://hapi.fhir.org/baseR4/Patient?birthdate=ge1980-01-01,lt1970-01-01
````

returns:

```
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "

Operation Outcome

\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\tERROR[]
DateRange parameter does not suppport OR queries
\n\t
"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "DateRange parameter does not suppport OR queries"
}
]
}
```

Vonk supports this search:

```
GET https://vonk.fire.ly/Patient?birthdate=ge1980-01-01,lt1970-01-01
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the FHIR search against /Patient?birthdate=ge1980-01-01,lt1970-01-01 with the Synthea data setup described. Trace the handling of comparator values combined with OR search parameters, and consider the issue done when the query returns patients born outside the 1970s instead of rejecting the search.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.