1

Help me please!

[GET] http://fhir.hl7fundamentals.org/r4/ServiceRequest?encounter:Encounter.participant.identifier=teste-brasil-v1|123abc456

The result is 1

[GET] http://fhir.hl7fundamentals.org/r4/ServiceRequest?encounter:Encounter.participant.practitioner.identifier=teste-brasil-v1|123abc456

The result is 2

I would like to put both parameters in the same url, but with the "or" operator, something like:

...? encounter:Encounter.participant.identifier=teste-brasil-v1|123abc456 or encounter:Encounter.participant.practitioner.identifier=teste-brasil-v1|123abc456

Objective is in a single url to obtain the result of 2 records

2 Answers2

2

You can't do it with a standard RESTful search. You'd have to use _filter which gives you the ability to 'or' parameters together. With REST, you can only do 'or' with the values for a single criteria. For example, you could search for encounters that have participants with identifier A or B (by separating the values you want to match on with ',').

Be aware that _filter isn't widely supported, so it may not be available on the server you're using.

Another option is to execute two separate queries, but send them in a batch so you only have to make one call. You'll end up with two result sets, and you'll have to page them independently, but it does let you get away with a single call.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • Thank you very much Lloyd McKenzie Could you please tell me how my url will look with "_filter"? Because my url has chained search. – Rodrigo Ruas Nov 16 '20 at 15:19
  • `?_filter=encounter:Encounter.participant.identifier eq teste-brasil-v1|123abc456 or encounter:Encounter.participant.practitioner.identifier=teste-brasil-v1|123abc456` (note that you'd need to escape the spaces) – Lloyd McKenzie Nov 16 '20 at 22:39
  • How do I know that the server supports the "_filter"? I ask, because on the server "http://fhir.hl7fundamentals.org", I ran the [GET] http://fhir.hl7fundamentals.org/r4/ServiceRequest?_filter=encounter:Encounter.participant.identifier eq teste-brasil- v1 | 123abc456 or encounter: Encounter.participant.practitioner.identifier = teste-brasil-v1 | 123abc456 according to your guidance and I obtained the return of all resource records – Rodrigo Ruas Nov 17 '20 at 03:19
  • The server's CapabilityStatement should list what search parameters are supported. – Lloyd McKenzie Nov 17 '20 at 14:09
-3

The Bitwise OR ( | ) returns a 1 in each bit position for which the corresponding bits of either or both operands are 1s

The Logical OR ( || ) returns true if and only if one or more of its operands is true the first true operand is returned or false if all operands are false

const a = 5;        // 00000000000000000000000000000101
const b = 3;        // 00000000000000000000000000000011

console.log(a | b); // 00000000000000000000000000000111
// expected output: 7
const a = 3;
const b = -2;

console.log(a > 0 || b > 0);
// expected output: true
LT-Sites
  • 375
  • 5
  • 15