```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns4:query_definition xmlns:ns2="http://www.i2b2.org/xsd/cell/crc/psm/1.1/" xmlns:ns4="http://www.i2b2.org/xsd/cell/crc/psm/querydefinition/1.1/" xmlns:ns3="http://www.i2b2.org/xsd/cell/crc/psm/analysisdefinition/1.1/">
    <query_name>External causes@23:40:57</query_name>
    <query_timing>ANY</query_timing>
    <specificity_scale>0</specificity_scale>
    <panel>
        <panel_number>1</panel_number>
        <panel_timing>ANY</panel_timing>
        <panel_accuracy_scale>100</panel_accuracy_scale>
        <invert>0</invert>
        <total_item_occurrences>1</total_item_occurrences>
        <item>
            <hlevel>0</hlevel>
            <item_name>(PrevQuery)External causes@23:38:14</item_name>
            <item_key>masterid:28350</item_key>
            <tooltip>External causes@23:38:14</tooltip>
            <item_is_synonym>false</item_is_synonym>
        </item>
        <item>
            <hlevel>0</hlevel>
            <item_name>Patient Set for "External causes@23:38:14"Patient setFINISHED</item_name>
            <item_key>patient_set_coll_id:61856</item_key>
            <tooltip>Patient Set for "External causes@23:38:14"Patient setFINISHED</tooltip>
            <item_is_synonym>false</item_is_synonym>
        </item>
        <item>
            <hlevel>0</hlevel>
            <item_name>Patient Set for "External causes@23:38:14"Patient setFINISHED</item_name>
            <item_key>patient_set_coll_id:61856</item_key>
            <tooltip>Patient Set for "External causes@23:38:14"Patient setFINISHED</tooltip>
            <item_is_synonym>false</item_is_synonym>
        </item>
        <item>
            <hlevel>0</hlevel>
            <item_name>Encounter Set for "External causes@23:37:39"Encounter setFINISHED</item_name>
            <item_key>patient_set_enc_id:61854</item_key>
            <tooltip>Encounter Set for "External causes@23:37:39"Encounter setFINISHED</tooltip>
            <item_is_synonym>false</item_is_synonym>
        </item>
    </panel>
</ns4:query_definition>

```

I want to find patients who have been diagnosed with external causes, such as accidents or injuries, at any time during their medical history, and I would like to include patients from a previously created patient set called "External causes@23:38:14" and its corresponding encounter set "External causes@23:37:39" in my analysis. The specificity scale is set to 0, meaning that all possible matches will be included, and the query timing is set to ANY, meaning that the condition could have occurred at any point in the patient's medical history. The panel accuracy scale is set to 100, indicating a high level of accuracy, and the panel will not be inverted. The total number of items in the query is 1.