@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<https://openrecruit.dev/fhir/Bundle/recruit-sample-study-transaction> a fhir:Bundle ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:Resource.id [ fhir:value "recruit-sample-study-transaction"] ;
  fhir:Resource.language [ fhir:value "en"] ;
  fhir:Bundle.type [ fhir:value "transaction"] ;
  fhir:Bundle.entry [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:ResearchStudy ;
       fhir:Resource.id [ fhir:value "98d96608-475f-4386-b7b5-6ddc1eb57e71" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/recruit-research-study" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/recruit-research-study>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"ResearchStudy_98d96608-475f-4386-b7b5-6ddc1eb57e71\"> </a><p class=\"res-header-id\"><b>Generated Narrative: ResearchStudy 98d96608-475f-4386-b7b5-6ddc1eb57e71</b></p><a name=\"98d96608-475f-4386-b7b5-6ddc1eb57e71\"> </a><a name=\"hc98d96608-475f-4386-b7b5-6ddc1eb57e71\"> </a><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\"/><p style=\"margin-bottom: 0px\">Profile: <a href=\"StructureDefinition-recruit-research-study.html\">RecruitResearchStudy</a></p></div><p><b>MII EX Studie Akronym</b>: DEMO-BRONCHITIS</p><p><b>identifier</b>: <a href=\"NamingSystem-sql-criteria-research-study-id.html\" title=\"The identifier system for a RecruitResearchStudy whose SQL-encoded criteria are authored as FSH, such as the demo study.\">SqlCriteriaResearchStudyIdentifier</a>/bronchitis</p><p><b>title</b>: Bronchitis Demo Study</p><p><b>status</b>: Active</p><p><b>enrollment</b>: <a href=\"Bundle-recruit-sample-study-transaction.html#Group_be24c1a6-b052-4360-871b-0a1b7b6bdfb4\">be24c1a6-b052-4360-871b-0a1b7b6bdfb4</a></p></div>"
       ] ;
       fhir:DomainResource.extension [
         fhir:index -1 ;
         fhir:Extension.url [ fhir:value "https://www.medizininformatik-initiative.de/fhir/modul-studie/StructureDefinition/mii-ex-studie-akronym" ] ;
         fhir:Extension.valueString [ fhir:value "DEMO-BRONCHITIS" ]
       ] ;
       fhir:ResearchStudy.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/sql-criteria-research-study-id" ] ;
         fhir:Identifier.value [ fhir:value "bronchitis" ]
       ] ;
       fhir:ResearchStudy.title [ fhir:value "Bronchitis Demo Study" ] ;
       fhir:ResearchStudy.status [ fhir:value "active" ] ;
       fhir:ResearchStudy.enrollment [
         fhir:index -1 ;
         fhir:link <https://openrecruit.dev/fhir/Group/be24c1a6-b052-4360-871b-0a1b7b6bdfb4> ;
         fhir:Reference.reference [ fhir:value "Group/be24c1a6-b052-4360-871b-0a1b7b6bdfb4" ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "ResearchStudy/98d96608-475f-4386-b7b5-6ddc1eb57e71" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:Group ;
       fhir:Resource.id [ fhir:value "be24c1a6-b052-4360-871b-0a1b7b6bdfb4" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/eligibility-group" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/eligibility-group>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"Group_be24c1a6-b052-4360-871b-0a1b7b6bdfb4\"> </a>\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"metadata\"> </a>Metadata</th>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">bronchitis</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Active</th>\n\n\n\n<td class=\"content-container\">true</td>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">Person</td>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Actual</th>\n\n\n\n<td class=\"content-container\">false</td>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Code</th>\n\n\n\n<td class=\"content-container\">SQL-encoded eligibility criteria\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
       ] ;
       fhir:Group.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/eligibility-group-id" ] ;
         fhir:Identifier.value [ fhir:value "bronchitis" ]
       ] ;
       fhir:Group.active [ fhir:value "true"^^xsd:boolean ] ;
       fhir:Group.type [ fhir:value "person" ] ;
       fhir:Group.actual [ fhir:value "false"^^xsd:boolean ] ;
       fhir:Group.code [
         fhir:CodeableConcept.coding [
           fhir:index -1 ;
           fhir:Coding.system [ fhir:value "https://openrecruit.dev/fhir/CodeSystem/eligibility-criteria-types" ] ;
           fhir:Coding.code [ fhir:value "sql-query" ]
         ] ;
         fhir:CodeableConcept.text [ fhir:value "SQL-encoded eligibility criteria" ]
       ] ;
       fhir:Group.characteristic [
         fhir:index -1 ;
         fhir:Group.characteristic.code [
           fhir:CodeableConcept.text [ fhir:value "Bronchitis diagnosis" ]
         ] ;
         fhir:Group.characteristic.valueReference [
           fhir:link <https://openrecruit.dev/fhir/Library/bb4e037a-0a43-4fee-befc-b9ed598c3e64> ;
           fhir:Reference.reference [ fhir:value "Library/bb4e037a-0a43-4fee-befc-b9ed598c3e64" ]
         ] ;
         fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
       ], [
         fhir:index -1 ;
         fhir:Group.characteristic.code [
           fhir:CodeableConcept.text [ fhir:value "Age > 18 years" ]
         ] ;
         fhir:Group.characteristic.valueReference [
           fhir:link <https://openrecruit.dev/fhir/Library/12b09320-2426-43e9-930d-64f151d39e68> ;
           fhir:Reference.reference [ fhir:value "Library/12b09320-2426-43e9-930d-64f151d39e68" ]
         ] ;
         fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
       ], [
         fhir:index -1 ;
         fhir:Group.characteristic.code [
           fhir:CodeableConcept.text [ fhir:value "No sepsis diagnosis within 3 months of the bronchitis diagnosis" ]
         ] ;
         fhir:Group.characteristic.valueReference [
           fhir:link <https://openrecruit.dev/fhir/Library/9be54194-a4d9-4835-bf9e-21314e4f046c> ;
           fhir:Reference.reference [ fhir:value "Library/9be54194-a4d9-4835-bf9e-21314e4f046c" ]
         ] ;
         fhir:Group.characteristic.exclude [ fhir:value "true"^^xsd:boolean ]
       ], [
         fhir:index -1 ;
         fhir:Group.characteristic.code [
           fhir:CodeableConcept.text [ fhir:value "LDL cholesterol below 190 mg/dL" ]
         ] ;
         fhir:Group.characteristic.valueReference [
           fhir:link <https://openrecruit.dev/fhir/Library/5f3c2a8e-7d41-4b9a-9e2f-6c1d8b0a4e73> ;
           fhir:Reference.reference [ fhir:value "Library/5f3c2a8e-7d41-4b9a-9e2f-6c1d8b0a4e73" ]
         ] ;
         fhir:Group.characteristic.exclude [ fhir:value "false"^^xsd:boolean ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "Group/be24c1a6-b052-4360-871b-0a1b7b6bdfb4" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:Library ;
       fhir:Resource.id [ fhir:value "bb4e037a-0a43-4fee-befc-b9ed598c3e64" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/sql-query-library" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/sql-query-library>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"Library_bb4e037a-0a43-4fee-befc-b9ed598c3e64\"> </a>\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"metadata\"> </a>Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">Bronchitis diagnosis</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">bronchitis</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>Active bronchitis diagnosis (SNOMED CT code 10509002).</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n    <a href=\"https://simplifier.net/resolve?scope=de.medizininformatikinitiative.kerndatensatz.studie@2026.0.2&amp;canonical=https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes\">https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes</a>#sql-query\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"parameters\"> </a>Parameters</th>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Parameter</th>\n\n\n\n<td class=\"content-container\">None</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=trinoContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=duckdbContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
       ] ;
       fhir:Library.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/sql-criteria-library-id" ] ;
         fhir:Identifier.value [ fhir:value "bronchitis" ]
       ] ;
       fhir:Library.name [ fhir:value "bronchitis" ] ;
       fhir:Library.title [ fhir:value "Bronchitis diagnosis" ] ;
       fhir:Library.status [ fhir:value "active" ] ;
       fhir:Library.type [
         fhir:CodeableConcept.coding [
           fhir:index -1 ;
           fhir:Coding.system [ fhir:value "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes" ] ;
           fhir:Coding.code [ fhir:value "sql-query" ]
         ]
       ] ;
       fhir:Library.description [ fhir:value "Active bronchitis diagnosis (SNOMED CT code 10509002)." ] ;
       fhir:Library.content [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    EXISTS (\n        SELECT 1\n        FROM\n            fhir.default.condition,\n            UNNEST(condition.code.coding) AS condition_coding\n        WHERE\n            condition.subject.reference = CONCAT('Patient/', patient.id)\n            AND condition_coding.system = 'http://snomed.info/sct'\n            AND condition_coding.code IN ('10509002')\n    ) AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=trino" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBFWElTVFMgKAogICAgICAgIFNFTEVDVCAxCiAgICAgICAgRlJPTQogICAgICAgICAgICBmaGlyLmRlZmF1bHQuY29uZGl0aW9uLAogICAgICAgICAgICBVTk5FU1QoY29uZGl0aW9uLmNvZGUuY29kaW5nKSBBUyBjb25kaXRpb25fY29kaW5nCiAgICAgICAgV0hFUkUKICAgICAgICAgICAgY29uZGl0aW9uLnN1YmplY3QucmVmZXJlbmNlID0gQ09OQ0FUKCdQYXRpZW50LycsIHBhdGllbnQuaWQpCiAgICAgICAgICAgIEFORCBjb25kaXRpb25fY29kaW5nLnN5c3RlbSA9ICdodHRwOi8vc25vbWVkLmluZm8vc2N0JwogICAgICAgICAgICBBTkQgY29uZGl0aW9uX2NvZGluZy5jb2RlIElOICgnMTA1MDkwMDInKQogICAgKSBBUyBpc19tZXQKRlJPTSBmaGlyLmRlZmF1bHQucGF0aWVudCBBUyBwYXRpZW50"^^xsd:base64Binary ]
       ], [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    EXISTS (\n        SELECT 1\n        FROM\n            fhir.default.condition,\n            UNNEST(condition.code.coding) AS u(condition_coding)\n        WHERE\n            condition.subject.reference = CONCAT('Patient/', patient.id)\n            AND condition_coding.system = 'http://snomed.info/sct'\n            AND condition_coding.code IN ('10509002')\n    ) AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=duckdb" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBFWElTVFMgKAogICAgICAgIFNFTEVDVCAxCiAgICAgICAgRlJPTQogICAgICAgICAgICBmaGlyLmRlZmF1bHQuY29uZGl0aW9uLAogICAgICAgICAgICBVTk5FU1QoY29uZGl0aW9uLmNvZGUuY29kaW5nKSBBUyB1KGNvbmRpdGlvbl9jb2RpbmcpCiAgICAgICAgV0hFUkUKICAgICAgICAgICAgY29uZGl0aW9uLnN1YmplY3QucmVmZXJlbmNlID0gQ09OQ0FUKCdQYXRpZW50LycsIHBhdGllbnQuaWQpCiAgICAgICAgICAgIEFORCBjb25kaXRpb25fY29kaW5nLnN5c3RlbSA9ICdodHRwOi8vc25vbWVkLmluZm8vc2N0JwogICAgICAgICAgICBBTkQgY29uZGl0aW9uX2NvZGluZy5jb2RlIElOICgnMTA1MDkwMDInKQogICAgKSBBUyBpc19tZXQKRlJPTSBmaGlyLmRlZmF1bHQucGF0aWVudCBBUyBwYXRpZW50"^^xsd:base64Binary ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "Library/bb4e037a-0a43-4fee-befc-b9ed598c3e64" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:Library ;
       fhir:Resource.id [ fhir:value "12b09320-2426-43e9-930d-64f151d39e68" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/sql-query-library" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/sql-query-library>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"Library_12b09320-2426-43e9-930d-64f151d39e68\"> </a>\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"metadata\"> </a>Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">Age over 18</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">age-over-18</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>Patient is over 18 years old.</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n    <a href=\"https://simplifier.net/resolve?scope=de.medizininformatikinitiative.kerndatensatz.studie@2026.0.2&amp;canonical=https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes\">https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes</a>#sql-query\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"parameters\"> </a>Parameters</th>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Parameter</th>\n\n\n\n<td class=\"content-container\">None</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=trinoContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=duckdbContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
       ] ;
       fhir:Library.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/sql-criteria-library-id" ] ;
         fhir:Identifier.value [ fhir:value "age-over-18" ]
       ] ;
       fhir:Library.name [ fhir:value "age-over-18" ] ;
       fhir:Library.title [ fhir:value "Age over 18" ] ;
       fhir:Library.status [ fhir:value "active" ] ;
       fhir:Library.type [
         fhir:CodeableConcept.coding [
           fhir:index -1 ;
           fhir:Coding.system [ fhir:value "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes" ] ;
           fhir:Coding.code [ fhir:value "sql-query" ]
         ]
       ] ;
       fhir:Library.description [ fhir:value "Patient is over 18 years old." ] ;
       fhir:Library.content [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    date_diff('year', date(patient.birthdate), current_date) > 18 AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=trino" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBkYXRlX2RpZmYoJ3llYXInLCBkYXRlKHBhdGllbnQuYmlydGhkYXRlKSwgY3VycmVudF9kYXRlKSA+IDE4IEFTIGlzX21ldApGUk9NIGZoaXIuZGVmYXVsdC5wYXRpZW50IEFTIHBhdGllbnQ="^^xsd:base64Binary ]
       ], [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    date_sub('year', CAST(patient.birthdate AS DATE), current_date) > 18 AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=duckdb" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBkYXRlX3N1YigneWVhcicsIENBU1QocGF0aWVudC5iaXJ0aGRhdGUgQVMgREFURSksIGN1cnJlbnRfZGF0ZSkgPiAxOCBBUyBpc19tZXQKRlJPTSBmaGlyLmRlZmF1bHQucGF0aWVudCBBUyBwYXRpZW50"^^xsd:base64Binary ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "Library/12b09320-2426-43e9-930d-64f151d39e68" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:Library ;
       fhir:Resource.id [ fhir:value "9be54194-a4d9-4835-bf9e-21314e4f046c" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/sql-query-library" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/sql-query-library>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"Library_9be54194-a4d9-4835-bf9e-21314e4f046c\"> </a>\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"metadata\"> </a>Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">Sepsis within 3 months of bronchitis</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">sepsis</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>Sepsis diagnosis (SNOMED CT code 91302008) with an onset within 3 months before or after a bronchitis diagnosis (SNOMED CT code 10509002), falling back to the recorded date where no onset is documented.</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n    <a href=\"https://simplifier.net/resolve?scope=de.medizininformatikinitiative.kerndatensatz.studie@2026.0.2&amp;canonical=https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes\">https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes</a>#sql-query\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"parameters\"> </a>Parameters</th>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Parameter</th>\n\n\n\n<td class=\"content-container\">None</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=trinoContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=duckdbContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
       ] ;
       fhir:Library.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/sql-criteria-library-id" ] ;
         fhir:Identifier.value [ fhir:value "sepsis" ]
       ] ;
       fhir:Library.name [ fhir:value "sepsis" ] ;
       fhir:Library.title [ fhir:value "Sepsis within 3 months of bronchitis" ] ;
       fhir:Library.status [ fhir:value "active" ] ;
       fhir:Library.type [
         fhir:CodeableConcept.coding [
           fhir:index -1 ;
           fhir:Coding.system [ fhir:value "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes" ] ;
           fhir:Coding.code [ fhir:value "sql-query" ]
         ]
       ] ;
       fhir:Library.description [ fhir:value "Sepsis diagnosis (SNOMED CT code 91302008) with an onset within 3 months before or after a bronchitis diagnosis (SNOMED CT code 10509002), falling back to the recorded date where no onset is documented." ] ;
       fhir:Library.content [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    EXISTS (\n        SELECT 1\n        FROM\n            fhir.default.condition AS sepsis,\n            UNNEST(sepsis.code.coding) AS sepsis_coding,\n            fhir.default.condition AS bronchitis,\n            UNNEST(bronchitis.code.coding) AS bronchitis_coding\n        WHERE\n            sepsis.subject.reference = CONCAT('Patient/', patient.id)\n            AND sepsis_coding.system = 'http://snomed.info/sct'\n            AND sepsis_coding.code IN ('91302008')\n            AND bronchitis.subject.reference = sepsis.subject.reference\n            AND bronchitis_coding.system = 'http://snomed.info/sct'\n            AND bronchitis_coding.code IN ('10509002')\n            AND from_iso8601_timestamp(COALESCE(sepsis.onsetdatetime, sepsis.recordeddate))\n                BETWEEN from_iso8601_timestamp(COALESCE(bronchitis.onsetdatetime, bronchitis.recordeddate)) - INTERVAL '3' MONTH\n                    AND from_iso8601_timestamp(COALESCE(bronchitis.onsetdatetime, bronchitis.recordeddate)) + INTERVAL '3' MONTH\n    ) AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=trino" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBFWElTVFMgKAogICAgICAgIFNFTEVDVCAxCiAgICAgICAgRlJPTQogICAgICAgICAgICBmaGlyLmRlZmF1bHQuY29uZGl0aW9uIEFTIHNlcHNpcywKICAgICAgICAgICAgVU5ORVNUKHNlcHNpcy5jb2RlLmNvZGluZykgQVMgc2Vwc2lzX2NvZGluZywKICAgICAgICAgICAgZmhpci5kZWZhdWx0LmNvbmRpdGlvbiBBUyBicm9uY2hpdGlzLAogICAgICAgICAgICBVTk5FU1QoYnJvbmNoaXRpcy5jb2RlLmNvZGluZykgQVMgYnJvbmNoaXRpc19jb2RpbmcKICAgICAgICBXSEVSRQogICAgICAgICAgICBzZXBzaXMuc3ViamVjdC5yZWZlcmVuY2UgPSBDT05DQVQoJ1BhdGllbnQvJywgcGF0aWVudC5pZCkKICAgICAgICAgICAgQU5EIHNlcHNpc19jb2Rpbmcuc3lzdGVtID0gJ2h0dHA6Ly9zbm9tZWQuaW5mby9zY3QnCiAgICAgICAgICAgIEFORCBzZXBzaXNfY29kaW5nLmNvZGUgSU4gKCc5MTMwMjAwOCcpCiAgICAgICAgICAgIEFORCBicm9uY2hpdGlzLnN1YmplY3QucmVmZXJlbmNlID0gc2Vwc2lzLnN1YmplY3QucmVmZXJlbmNlCiAgICAgICAgICAgIEFORCBicm9uY2hpdGlzX2NvZGluZy5zeXN0ZW0gPSAnaHR0cDovL3Nub21lZC5pbmZvL3NjdCcKICAgICAgICAgICAgQU5EIGJyb25jaGl0aXNfY29kaW5nLmNvZGUgSU4gKCcxMDUwOTAwMicpCiAgICAgICAgICAgIEFORCBmcm9tX2lzbzg2MDFfdGltZXN0YW1wKENPQUxFU0NFKHNlcHNpcy5vbnNldGRhdGV0aW1lLCBzZXBzaXMucmVjb3JkZWRkYXRlKSkKICAgICAgICAgICAgICAgIEJFVFdFRU4gZnJvbV9pc284NjAxX3RpbWVzdGFtcChDT0FMRVNDRShicm9uY2hpdGlzLm9uc2V0ZGF0ZXRpbWUsIGJyb25jaGl0aXMucmVjb3JkZWRkYXRlKSkgLSBJTlRFUlZBTCAnMycgTU9OVEgKICAgICAgICAgICAgICAgICAgICBBTkQgZnJvbV9pc284NjAxX3RpbWVzdGFtcChDT0FMRVNDRShicm9uY2hpdGlzLm9uc2V0ZGF0ZXRpbWUsIGJyb25jaGl0aXMucmVjb3JkZWRkYXRlKSkgKyBJTlRFUlZBTCAnMycgTU9OVEgKICAgICkgQVMgaXNfbWV0CkZST00gZmhpci5kZWZhdWx0LnBhdGllbnQgQVMgcGF0aWVudA=="^^xsd:base64Binary ]
       ], [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    EXISTS (\n        SELECT 1\n        FROM\n            (\n                SELECT\n                    sepsis.subject.reference AS subject_reference,\n                    CAST(COALESCE(sepsis.onsetdatetime, sepsis.recordeddate) AS TIMESTAMPTZ) AS onset\n                FROM\n                    fhir.default.condition AS sepsis,\n                    UNNEST(sepsis.code.coding) AS u(sepsis_coding)\n                WHERE\n                    sepsis_coding.system = 'http://snomed.info/sct'\n                    AND sepsis_coding.code IN ('91302008')\n            ) AS sepsis\n            JOIN (\n                SELECT\n                    bronchitis.subject.reference AS subject_reference,\n                    CAST(COALESCE(bronchitis.onsetdatetime, bronchitis.recordeddate) AS TIMESTAMPTZ) AS onset\n                FROM\n                    fhir.default.condition AS bronchitis,\n                    UNNEST(bronchitis.code.coding) AS v(bronchitis_coding)\n                WHERE\n                    bronchitis_coding.system = 'http://snomed.info/sct'\n                    AND bronchitis_coding.code IN ('10509002')\n            ) AS bronchitis ON bronchitis.subject_reference = sepsis.subject_reference\n        WHERE\n            sepsis.subject_reference = CONCAT('Patient/', patient.id)\n            AND sepsis.onset\n                BETWEEN bronchitis.onset - INTERVAL 3 MONTH\n                    AND bronchitis.onset + INTERVAL 3 MONTH\n    ) AS is_met\nFROM fhir.default.patient AS patient" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=duckdb" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBFWElTVFMgKAogICAgICAgIFNFTEVDVCAxCiAgICAgICAgRlJPTQogICAgICAgICAgICAoCiAgICAgICAgICAgICAgICBTRUxFQ1QKICAgICAgICAgICAgICAgICAgICBzZXBzaXMuc3ViamVjdC5yZWZlcmVuY2UgQVMgc3ViamVjdF9yZWZlcmVuY2UsCiAgICAgICAgICAgICAgICAgICAgQ0FTVChDT0FMRVNDRShzZXBzaXMub25zZXRkYXRldGltZSwgc2Vwc2lzLnJlY29yZGVkZGF0ZSkgQVMgVElNRVNUQU1QVFopIEFTIG9uc2V0CiAgICAgICAgICAgICAgICBGUk9NCiAgICAgICAgICAgICAgICAgICAgZmhpci5kZWZhdWx0LmNvbmRpdGlvbiBBUyBzZXBzaXMsCiAgICAgICAgICAgICAgICAgICAgVU5ORVNUKHNlcHNpcy5jb2RlLmNvZGluZykgQVMgdShzZXBzaXNfY29kaW5nKQogICAgICAgICAgICAgICAgV0hFUkUKICAgICAgICAgICAgICAgICAgICBzZXBzaXNfY29kaW5nLnN5c3RlbSA9ICdodHRwOi8vc25vbWVkLmluZm8vc2N0JwogICAgICAgICAgICAgICAgICAgIEFORCBzZXBzaXNfY29kaW5nLmNvZGUgSU4gKCc5MTMwMjAwOCcpCiAgICAgICAgICAgICkgQVMgc2Vwc2lzCiAgICAgICAgICAgIEpPSU4gKAogICAgICAgICAgICAgICAgU0VMRUNUCiAgICAgICAgICAgICAgICAgICAgYnJvbmNoaXRpcy5zdWJqZWN0LnJlZmVyZW5jZSBBUyBzdWJqZWN0X3JlZmVyZW5jZSwKICAgICAgICAgICAgICAgICAgICBDQVNUKENPQUxFU0NFKGJyb25jaGl0aXMub25zZXRkYXRldGltZSwgYnJvbmNoaXRpcy5yZWNvcmRlZGRhdGUpIEFTIFRJTUVTVEFNUFRaKSBBUyBvbnNldAogICAgICAgICAgICAgICAgRlJPTQogICAgICAgICAgICAgICAgICAgIGZoaXIuZGVmYXVsdC5jb25kaXRpb24gQVMgYnJvbmNoaXRpcywKICAgICAgICAgICAgICAgICAgICBVTk5FU1QoYnJvbmNoaXRpcy5jb2RlLmNvZGluZykgQVMgdihicm9uY2hpdGlzX2NvZGluZykKICAgICAgICAgICAgICAgIFdIRVJFCiAgICAgICAgICAgICAgICAgICAgYnJvbmNoaXRpc19jb2Rpbmcuc3lzdGVtID0gJ2h0dHA6Ly9zbm9tZWQuaW5mby9zY3QnCiAgICAgICAgICAgICAgICAgICAgQU5EIGJyb25jaGl0aXNfY29kaW5nLmNvZGUgSU4gKCcxMDUwOTAwMicpCiAgICAgICAgICAgICkgQVMgYnJvbmNoaXRpcyBPTiBicm9uY2hpdGlzLnN1YmplY3RfcmVmZXJlbmNlID0gc2Vwc2lzLnN1YmplY3RfcmVmZXJlbmNlCiAgICAgICAgV0hFUkUKICAgICAgICAgICAgc2Vwc2lzLnN1YmplY3RfcmVmZXJlbmNlID0gQ09OQ0FUKCdQYXRpZW50LycsIHBhdGllbnQuaWQpCiAgICAgICAgICAgIEFORCBzZXBzaXMub25zZXQKICAgICAgICAgICAgICAgIEJFVFdFRU4gYnJvbmNoaXRpcy5vbnNldCAtIElOVEVSVkFMIDMgTU9OVEgKICAgICAgICAgICAgICAgICAgICBBTkQgYnJvbmNoaXRpcy5vbnNldCArIElOVEVSVkFMIDMgTU9OVEgKICAgICkgQVMgaXNfbWV0CkZST00gZmhpci5kZWZhdWx0LnBhdGllbnQgQVMgcGF0aWVudA=="^^xsd:base64Binary ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "Library/9be54194-a4d9-4835-bf9e-21314e4f046c" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:Bundle.entry.resource [
       a fhir:Library ;
       fhir:Resource.id [ fhir:value "5f3c2a8e-7d41-4b9a-9e2f-6c1d8b0a4e73" ] ;
       fhir:Resource.meta [
         fhir:Meta.profile [
           fhir:value "https://openrecruit.dev/fhir/StructureDefinition/sql-query-library" ;
           fhir:index -1 ;
           fhir:link <https://openrecruit.dev/fhir/StructureDefinition/sql-query-library>
         ]
       ] ;
       fhir:Resource.language [ fhir:value "en" ] ;
       fhir:DomainResource.text [
         fhir:Narrative.status [ fhir:value "extensions" ] ;
         fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><a name=\"Library_5f3c2a8e-7d41-4b9a-9e2f-6c1d8b0a4e73\"> </a>\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"metadata\"> </a>Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">LDL cholesterol below 190 mg/dL</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">ldl-below-190</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>Every LDL cholesterol result (LOINC 18262-6) is below 190 mg/dL. Unknown if the patient has no LDL result, and indeterminate if results lie on both sides of the threshold, to demonstrate criteria the data doesn't settle.</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n    <a href=\"https://simplifier.net/resolve?scope=de.medizininformatikinitiative.kerndatensatz.studie@2026.0.2&amp;canonical=https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes\">https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes</a>#sql-query\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"parameters\"> </a>Parameters</th>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Parameter</th>\n\n\n\n<td class=\"content-container\">None</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=trinoContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">application/sql;dialect=duckdbContent</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code>Encoded data </code></pre>\n      </td>\n    </tr>\n    \n  \n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
       ] ;
       fhir:Library.identifier [
         fhir:index -1 ;
         fhir:Identifier.system [ fhir:value "https://openrecruit.dev/fhir/identifiers/sql-criteria-library-id" ] ;
         fhir:Identifier.value [ fhir:value "ldl-below-190" ]
       ] ;
       fhir:Library.name [ fhir:value "ldl-below-190" ] ;
       fhir:Library.title [ fhir:value "LDL cholesterol below 190 mg/dL" ] ;
       fhir:Library.status [ fhir:value "active" ] ;
       fhir:Library.type [
         fhir:CodeableConcept.coding [
           fhir:index -1 ;
           fhir:Coding.system [ fhir:value "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes" ] ;
           fhir:Coding.code [ fhir:value "sql-query" ]
         ]
       ] ;
       fhir:Library.description [ fhir:value "Every LDL cholesterol result (LOINC 18262-6) is below 190 mg/dL. Unknown if the patient has no LDL result, and indeterminate if results lie on both sides of the threshold, to demonstrate criteria the data doesn't settle." ] ;
       fhir:Library.content [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    CASE\n        WHEN max(ldl.value) < 190 THEN TRUE\n        WHEN min(ldl.value) >= 190 THEN FALSE\n    END AS is_met,\n    count(ldl.value) > 0 AND min(ldl.value) < 190 AND max(ldl.value) >= 190 AS is_indeterminate,\n    CASE\n        WHEN count(ldl.value) = 0 THEN 'No LDL cholesterol result'\n        WHEN min(ldl.value) < 190 AND max(ldl.value) >= 190\n            THEN 'LDL cholesterol results between ' || format('%.1f', CAST(min(ldl.value) AS DOUBLE)) || ' and '\n                || format('%.1f', CAST(max(ldl.value) AS DOUBLE)) || ' mg/dL'\n    END AS result_note\nFROM fhir.default.patient AS patient\nLEFT JOIN (\n    SELECT observation.subject.reference AS subject_reference, observation.valuequantity.value AS value\n    FROM fhir.default.observation, UNNEST(observation.code.coding) AS observation_coding\n    WHERE observation_coding.system = 'http://loinc.org' AND observation_coding.code = '18262-6'\n) AS ldl ON ldl.subject_reference = CONCAT('Patient/', patient.id)\nGROUP BY patient.id" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=trino" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBDQVNFCiAgICAgICAgV0hFTiBtYXgobGRsLnZhbHVlKSA8IDE5MCBUSEVOIFRSVUUKICAgICAgICBXSEVOIG1pbihsZGwudmFsdWUpID49IDE5MCBUSEVOIEZBTFNFCiAgICBFTkQgQVMgaXNfbWV0LAogICAgY291bnQobGRsLnZhbHVlKSA+IDAgQU5EIG1pbihsZGwudmFsdWUpIDwgMTkwIEFORCBtYXgobGRsLnZhbHVlKSA+PSAxOTAgQVMgaXNfaW5kZXRlcm1pbmF0ZSwKICAgIENBU0UKICAgICAgICBXSEVOIGNvdW50KGxkbC52YWx1ZSkgPSAwIFRIRU4gJ05vIExETCBjaG9sZXN0ZXJvbCByZXN1bHQnCiAgICAgICAgV0hFTiBtaW4obGRsLnZhbHVlKSA8IDE5MCBBTkQgbWF4KGxkbC52YWx1ZSkgPj0gMTkwCiAgICAgICAgICAgIFRIRU4gJ0xETCBjaG9sZXN0ZXJvbCByZXN1bHRzIGJldHdlZW4gJyB8fCBmb3JtYXQoJyUuMWYnLCBDQVNUKG1pbihsZGwudmFsdWUpIEFTIERPVUJMRSkpIHx8ICcgYW5kICcKICAgICAgICAgICAgICAgIHx8IGZvcm1hdCgnJS4xZicsIENBU1QobWF4KGxkbC52YWx1ZSkgQVMgRE9VQkxFKSkgfHwgJyBtZy9kTCcKICAgIEVORCBBUyByZXN1bHRfbm90ZQpGUk9NIGZoaXIuZGVmYXVsdC5wYXRpZW50IEFTIHBhdGllbnQKTEVGVCBKT0lOICgKICAgIFNFTEVDVCBvYnNlcnZhdGlvbi5zdWJqZWN0LnJlZmVyZW5jZSBBUyBzdWJqZWN0X3JlZmVyZW5jZSwgb2JzZXJ2YXRpb24udmFsdWVxdWFudGl0eS52YWx1ZSBBUyB2YWx1ZQogICAgRlJPTSBmaGlyLmRlZmF1bHQub2JzZXJ2YXRpb24sIFVOTkVTVChvYnNlcnZhdGlvbi5jb2RlLmNvZGluZykgQVMgb2JzZXJ2YXRpb25fY29kaW5nCiAgICBXSEVSRSBvYnNlcnZhdGlvbl9jb2Rpbmcuc3lzdGVtID0gJ2h0dHA6Ly9sb2luYy5vcmcnIEFORCBvYnNlcnZhdGlvbl9jb2RpbmcuY29kZSA9ICcxODI2Mi02JwopIEFTIGxkbCBPTiBsZGwuc3ViamVjdF9yZWZlcmVuY2UgPSBDT05DQVQoJ1BhdGllbnQvJywgcGF0aWVudC5pZCkKR1JPVVAgQlkgcGF0aWVudC5pZA=="^^xsd:base64Binary ]
       ], [
         fhir:index -1 ;
         fhir:Element.extension [
           fhir:index -1 ;
           fhir:Extension.url [ fhir:value "https://sql-on-fhir.org/ig/StructureDefinition/sql-text" ] ;
           fhir:Extension.valueString [ fhir:value "SELECT\n    patient.id AS patient_id,\n    CASE\n        WHEN max(ldl.value) < 190 THEN TRUE\n        WHEN min(ldl.value) >= 190 THEN FALSE\n    END AS is_met,\n    count(ldl.value) > 0 AND min(ldl.value) < 190 AND max(ldl.value) >= 190 AS is_indeterminate,\n    CASE\n        WHEN count(ldl.value) = 0 THEN 'No LDL cholesterol result'\n        WHEN min(ldl.value) < 190 AND max(ldl.value) >= 190\n            THEN 'LDL cholesterol results between ' || printf('%.1f', CAST(min(ldl.value) AS DOUBLE)) || ' and '\n                || printf('%.1f', CAST(max(ldl.value) AS DOUBLE)) || ' mg/dL'\n    END AS result_note\nFROM fhir.default.patient AS patient\nLEFT JOIN (\n    SELECT observation.subject.reference AS subject_reference, observation.valuequantity.value AS value\n    FROM fhir.default.observation, UNNEST(observation.code.coding) AS u(observation_coding)\n    WHERE observation_coding.system = 'http://loinc.org' AND observation_coding.code = '18262-6'\n) AS ldl ON ldl.subject_reference = CONCAT('Patient/', patient.id)\nGROUP BY patient.id" ]
         ] ;
         fhir:Attachment.contentType [ fhir:value "application/sql;dialect=duckdb" ] ;
         fhir:Attachment.data [ fhir:value "U0VMRUNUCiAgICBwYXRpZW50LmlkIEFTIHBhdGllbnRfaWQsCiAgICBDQVNFCiAgICAgICAgV0hFTiBtYXgobGRsLnZhbHVlKSA8IDE5MCBUSEVOIFRSVUUKICAgICAgICBXSEVOIG1pbihsZGwudmFsdWUpID49IDE5MCBUSEVOIEZBTFNFCiAgICBFTkQgQVMgaXNfbWV0LAogICAgY291bnQobGRsLnZhbHVlKSA+IDAgQU5EIG1pbihsZGwudmFsdWUpIDwgMTkwIEFORCBtYXgobGRsLnZhbHVlKSA+PSAxOTAgQVMgaXNfaW5kZXRlcm1pbmF0ZSwKICAgIENBU0UKICAgICAgICBXSEVOIGNvdW50KGxkbC52YWx1ZSkgPSAwIFRIRU4gJ05vIExETCBjaG9sZXN0ZXJvbCByZXN1bHQnCiAgICAgICAgV0hFTiBtaW4obGRsLnZhbHVlKSA8IDE5MCBBTkQgbWF4KGxkbC52YWx1ZSkgPj0gMTkwCiAgICAgICAgICAgIFRIRU4gJ0xETCBjaG9sZXN0ZXJvbCByZXN1bHRzIGJldHdlZW4gJyB8fCBwcmludGYoJyUuMWYnLCBDQVNUKG1pbihsZGwudmFsdWUpIEFTIERPVUJMRSkpIHx8ICcgYW5kICcKICAgICAgICAgICAgICAgIHx8IHByaW50ZignJS4xZicsIENBU1QobWF4KGxkbC52YWx1ZSkgQVMgRE9VQkxFKSkgfHwgJyBtZy9kTCcKICAgIEVORCBBUyByZXN1bHRfbm90ZQpGUk9NIGZoaXIuZGVmYXVsdC5wYXRpZW50IEFTIHBhdGllbnQKTEVGVCBKT0lOICgKICAgIFNFTEVDVCBvYnNlcnZhdGlvbi5zdWJqZWN0LnJlZmVyZW5jZSBBUyBzdWJqZWN0X3JlZmVyZW5jZSwgb2JzZXJ2YXRpb24udmFsdWVxdWFudGl0eS52YWx1ZSBBUyB2YWx1ZQogICAgRlJPTSBmaGlyLmRlZmF1bHQub2JzZXJ2YXRpb24sIFVOTkVTVChvYnNlcnZhdGlvbi5jb2RlLmNvZGluZykgQVMgdShvYnNlcnZhdGlvbl9jb2RpbmcpCiAgICBXSEVSRSBvYnNlcnZhdGlvbl9jb2Rpbmcuc3lzdGVtID0gJ2h0dHA6Ly9sb2luYy5vcmcnIEFORCBvYnNlcnZhdGlvbl9jb2RpbmcuY29kZSA9ICcxODI2Mi02JwopIEFTIGxkbCBPTiBsZGwuc3ViamVjdF9yZWZlcmVuY2UgPSBDT05DQVQoJ1BhdGllbnQvJywgcGF0aWVudC5pZCkKR1JPVVAgQlkgcGF0aWVudC5pZA=="^^xsd:base64Binary ]
       ]
     ] ;
     fhir:Bundle.entry.request [
       fhir:Bundle.entry.request.method [ fhir:value "PUT" ] ;
       fhir:Bundle.entry.request.url [ fhir:value "Library/5f3c2a8e-7d41-4b9a-9e2f-6c1d8b0a4e73" ]
     ]
  ] .

# - ontology header ------------------------------------------------------------

<https://openrecruit.dev/fhir/Bundle/recruit-sample-study-transaction.ttl> a owl:Ontology ;
  owl:imports fhir:fhir.ttl .

# -------------------------------------------------------------------------------------

