{
"description": "The SQLQuery profile represents a SQL query that runs against ViewDefinition\\ntables. It bundles the SQL, dependencies, and parameters for sharing and\\nversioning.",
"_filename": "StructureDefinition-SQLQuery.json",
"package_name": "io.health-samurai.core.r3",
"date": "2026-03-31T14:17:59+00:00",
"derivation": "constraint",
"publisher": "SQL on FHIR Working Group",
"fhirVersion": "3.0.2",
"jurisdiction": [ {
"coding": [ {
"code": "001",
"system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
"display": "World"
} ]
} ],
"name": "SQLQuery",
"mapping": [ {
"uri": "http://hl7.org/fhir/fivews",
"name": "FiveWs Pattern Mapping",
"identity": "w5"
}, {
"uri": "http://hl7.org/v3",
"name": "RIM Mapping",
"identity": "rim"
}, {
"uri": "http://hl7.org/fhir/object-implementation",
"name": "Object Implementation Information",
"identity": "objimpl"
} ],
"abstract": false,
"type": "Library",
"experimental": null,
"resourceType": "StructureDefinition",
"title": "SQL Query Library",
"package_version": "0.2604.1",
"extension": [ {
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-implements",
"valueUri": "http://hl7.org/fhir/StructureDefinition/MetadataResource"
} ],
"status": "draft",
"id": "e0df8c33-48c1-4751-b6d7-104235e24a3e",
"kind": "resource",
"url": "https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery",
"version": "0.2604.1",
"differential": {
"element": [ {
"id": "Library",
"path": "Library",
"constraint": [ {
"key": "sql-must-be-sql-expressions",
"human": "The content of the Library must be SQL expressions.",
"source": "https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery",
"severity": "error",
"expression": "content.all(contentType.startsWith('application/sql'))"
} ]
}, {
"id": "Library.type",
"path": "Library.type",
"patternCodeableConcept": {
"coding": [ {
"code": "sql-query",
"system": "https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes"
} ]
}
}, {
"id": "Library.relatedArtifact",
"path": "Library.relatedArtifact",
"mustSupport": true
}, {
"id": "Library.relatedArtifact.type",
"path": "Library.relatedArtifact.type",
"short": "depends-on for ViewDefinition references",
"mustSupport": true
}, {
"id": "Library.relatedArtifact.label",
"min": 1,
"path": "Library.relatedArtifact.label",
"short": "Table name used in SQL query",
"constraint": [ {
"key": "sql-name",
"human": "Name is limited to letters, numbers, or underscores and cannot start with an\nunderscore -- i.e. with a regular expression of: ^[A-Za-z][A-Za-z0-9_]*$ \n\n\nThis makes it usable as table names in a wide variety of databases.",
"source": "https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery",
"severity": "error",
"expression": "empty() or matches('^[A-Za-z][A-Za-z0-9_]*$')"
} ],
"mustSupport": true
}, {
"id": "Library.relatedArtifact.resource",
"min": 1,
"path": "Library.relatedArtifact.resource",
"short": "Canonical URL of ViewDefinition",
"mustSupport": true
}, {
"id": "Library.parameter",
"path": "Library.parameter",
"mustSupport": true
}, {
"id": "Library.parameter.name",
"min": 1,
"path": "Library.parameter.name",
"mustSupport": true
}, {
"id": "Library.parameter.use",
"path": "Library.parameter.use",
"short": "in (query parameters are always input)",
"mustSupport": true
}, {
"id": "Library.parameter.type",
"path": "Library.parameter.type",
"mustSupport": true
}, {
"id": "Library.content",
"min": 1,
"path": "Library.content",
"mustSupport": true
}, {
"id": "Library.content.extension:sqlText",
"max": "1",
"min": 0,
"path": "Library.content.extension",
"type": [ {
"code": "Extension",
"profile": "https://sql-on-fhir.org/ig/StructureDefinition/sql-text"
} ],
"short": "Plain-text SQL for readability",
"sliceName": "sqlText",
"mustSupport": true
}, {
"id": "Library.content.contentType",
"min": 1,
"path": "Library.content.contentType",
"short": "application/sql or application/sql;dialect=...",
"binding": {
"strength": "example",
"valueSetUri": "https://sql-on-fhir.org/ig/ValueSet/AllSQLContentTypeCodes"
},
"mustSupport": true
}, {
"id": "Library.content.data",
"min": 1,
"path": "Library.content.data",
"short": "SQL query (base64-encoded)",
"mustSupport": true
} ]
},
"contact": [ {
"name": "SQL on FHIR Working Group",
"telecom": [ {
"value": "https://sql-on-fhir.org",
"system": "url"
} ]
} ],
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Library"
}