ODK rookie with question about relevance logic and multiple select question

Hello, I'm very new to ODK- here is my question.

We first have a multiple select question (case_definition). Based on the criteria selected, the person will either continue the survey or end.

The survey continues to the patient_info group if (the respondent selects fever, and either cough or shortness of breath), OR (if the respondent selects at least one of fever or cough or shortness of breath, and selects either travel history or contact).

If one of these combinations is not met, the survey will end.

So I know I need relevance logic in the patient_info group, but I'm not sure the best way to write the logic statement. I've attached my first attempt in the image below! Any suggestions would be greatly appreciated!

example of form

Hi @rhuebsch
welcome to the forum! Please introduce yourself here!

what you started doing was correct you just need to prepare that complex expression. i think it will be:

(selected(${case_definition}, 'fever') and (selected(${case_definition}, 'cough') or selected(${case_definition}, 'shortness_of_breath')))
or ((selected(${case_definition}, 'fever') or selected(${case_definition}, 'cough') or selected(${case_definition}, 'shortness_of_breath')) and
    (selected(${case_definition}, 'travel_history') or selected(${case_definition}, 'contract')))

You didn't attach your form so I didn't test it maybe I made a small mistake somewhere but you can take a look.

If readability is important for you such an expression might by divided into 2/3 smaller it's also possible

Thank you so much for the quick help! That looks promising. I'll give it a try!

@Grzesiek2010 Just wanted to provide a final update, and let you know that your solution worked! Thanks for the help.