@prefix clinical: <https://ns.cascadeprotocol.org/clinical/v1#> .
@prefix cascade: <https://ns.cascadeprotocol.org/core/v1#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix fhir: <http://hl7.org/fhir/> .
@prefix sct: <http://snomed.info/sct/> .
@prefix loinc: <http://loinc.org/rdf#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix health: <https://ns.cascadeprotocol.org/health/v1#> .

# ============================================================================
# Ontology Metadata
# ============================================================================

<https://ns.cascadeprotocol.org/clinical/v1#> a owl:Ontology ;
    owl:imports <https://ns.cascadeprotocol.org/core/v1#> ;
    dct:title "Cascade Protocol Clinical Document Ontology"@en ;
    dct:description "Vocabulary for clinical documents, narratives, and structured notes imported from EHR systems via Apple HealthKit"@en ;
    dct:creator "Cascade Agentic Labs" ;
    dct:created "2025-12-26"^^xsd:date ;
    dct:modified "2026-08-14"^^xsd:date ;
    owl:versionInfo "1.15" ;
    rdfs:comment "Domain-specific vocabulary for clinical documentation and structured records imported from patient portals (MyChart, Epic, etc.). Contains EHR-verified clinical data."@en ;
    rdfs:seeAlso <https://cascadeprotocol.org/docs/clinical/v1.0/> .

# ============================================================================
# Core Classes
# ============================================================================

clinical:ClinicalDocument a owl:Class ;
    rdfs:label "Clinical Document"@en ;
    rdfs:comment "Clinical documentation imported from EHR systems, including narratives and structured data"@en ;
    rdfs:subClassOf fhir:DocumentReference ;
    rdfs:subClassOf prov:Entity ;
    rdfs:subClassOf [
        a owl:Restriction ;
        owl:onProperty clinical:importedAt ;
        owl:cardinality 1
    ] ;
    rdfs:subClassOf [
        a owl:Restriction ;
        owl:onProperty clinical:sourceEHR ;
        owl:cardinality 1
    ] .

clinical:ClinicalSection a owl:Class ;
    rdfs:label "Clinical Section"@en ;
    rdfs:comment "Section within a clinical document (e.g., History of Present Illness, Assessment, Plan)"@en .

clinical:ClinicalNarrative a owl:Class ;
    rdfs:label "Clinical Narrative"@en ;
    rdfs:comment "Free-text clinical narrative extracted from FHIR text.div element"@en .

# ============================================================================
# Document Type Classes (LOINC-aligned)
# ============================================================================

clinical:ProgressNote a owl:Class ;
    rdfs:label "Progress Note"@en ;
    rdfs:comment "Provider progress note documenting a patient encounter"@en ;
    rdfs:subClassOf clinical:ClinicalDocument .

clinical:DischargeSummary a owl:Class ;
    rdfs:label "Discharge Summary"@en ;
    rdfs:comment "Hospital discharge summary document"@en ;
    rdfs:subClassOf clinical:ClinicalDocument .

clinical:ConsultationNote a owl:Class ;
    rdfs:label "Consultation Note"@en ;
    rdfs:comment "Specialist consultation note"@en ;
    rdfs:subClassOf clinical:ClinicalDocument .

clinical:LaboratoryReport a owl:Class ;
    rdfs:label "Laboratory Report"@en ;
    rdfs:comment "Laboratory test results with narrative interpretation"@en ;
    rdfs:subClassOf clinical:ClinicalDocument ;
    rdfs:subClassOf fhir:DiagnosticReport .

clinical:ImagingReport a owl:Class ;
    rdfs:label "Imaging Report"@en ;
    rdfs:comment "Radiology/imaging report with findings and impressions"@en ;
    rdfs:subClassOf clinical:ClinicalDocument .

clinical:VisitSummary a owl:Class ;
    rdfs:label "Visit Summary"@en ;
    rdfs:comment "After-visit summary provided to patient"@en ;
    rdfs:subClassOf clinical:ClinicalDocument .

# ============================================================================
# Structured Clinical Record Classes
# ============================================================================

clinical:Medication a owl:Class ;
    rdfs:label "Medication"@en ;
    rdfs:comment "Medication record from EHR MedicationStatement or MedicationRequest resource"@en ;
    rdfs:subClassOf fhir:MedicationStatement ;
    rdfs:subClassOf prov:Entity .

clinical:Allergy a owl:Class ;
    rdfs:label "Allergy"@en ;
    rdfs:comment "Allergy or intolerance record from EHR AllergyIntolerance resource. DEPRECATED in clinical v1.13: use health:AllergyRecord, which is the type every import path already emits. Retained, not removed: the pod export path is still the sole emitter of this class and existing pods contain it. Readers must continue to accept both."@en ;
    rdfs:subClassOf fhir:AllergyIntolerance ;
    rdfs:subClassOf prov:Entity ;
    owl:deprecated true ;
    rdfs:seeAlso <https://ns.cascadeprotocol.org/health/v1#AllergyRecord> ;
    owl:versionInfo "Deprecated in clinical v1.13; superseded by health:AllergyRecord" .

clinical:LabResult a owl:Class ;
    rdfs:label "Lab Result"@en ;
    rdfs:comment "Laboratory test result from EHR Observation resource. DEPRECATED in clinical v1.13: use health:LabResultRecord, which is the type every import path already emits. Retained, not removed: the pod export path is still the sole emitter of this class and existing pods contain it. Readers must continue to accept both."@en ;
    rdfs:subClassOf fhir:Observation ;
    rdfs:subClassOf prov:Entity ;
    owl:deprecated true ;
    rdfs:seeAlso <https://ns.cascadeprotocol.org/health/v1#LabResultRecord> ;
    owl:versionInfo "Deprecated in clinical v1.13; superseded by health:LabResultRecord" .

clinical:Condition a owl:Class ;
    rdfs:label "Condition"@en ;
    rdfs:comment "Medical condition or diagnosis from EHR Condition resource. DEPRECATED in clinical v1.13: use health:ConditionRecord, which is the type every import path already emits. Retained, not removed: the pod export path is still the sole emitter of this class and existing pods contain it. Readers must continue to accept both."@en ;
    rdfs:subClassOf fhir:Condition ;
    rdfs:subClassOf prov:Entity ;
    owl:deprecated true ;
    rdfs:seeAlso <https://ns.cascadeprotocol.org/health/v1#ConditionRecord> ;
    owl:versionInfo "Deprecated in clinical v1.13; superseded by health:ConditionRecord" .

clinical:Immunization a owl:Class ;
    rdfs:label "Immunization"@en ;
    rdfs:comment "Vaccination record from EHR Immunization resource. DEPRECATED in clinical v1.13: use health:ImmunizationRecord, which is the type every import path already emits. Retained, not removed: the pod export path is still the sole emitter of this class and existing pods contain it. Readers must continue to accept both."@en ;
    rdfs:subClassOf fhir:Immunization ;
    rdfs:subClassOf prov:Entity ;
    owl:deprecated true ;
    rdfs:seeAlso <https://ns.cascadeprotocol.org/health/v1#ImmunizationRecord> ;
    owl:versionInfo "Deprecated in clinical v1.13; superseded by health:ImmunizationRecord" .

clinical:Procedure a owl:Class ;
    rdfs:label "Procedure"@en ;
    rdfs:comment "Medical procedure record from EHR Procedure resource"@en ;
    rdfs:subClassOf fhir:Procedure ;
    rdfs:subClassOf prov:Entity .

clinical:VitalSign a owl:Class ;
    rdfs:label "Vital Sign"@en ;
    rdfs:comment "Vital sign observation (heart rate, blood pressure, etc.) from EHR"@en ;
    rdfs:subClassOf fhir:Observation ;
    rdfs:subClassOf prov:Entity .

# ============================================================================
# Longitudinal Record Classes (v1.2)
# ============================================================================

clinical:MedicationUseEpisode a owl:Class ;
    rdfs:label "Medication Use Episode"@en ;
    rdfs:comment "Canonical longitudinal record of patient's relationship with a medication over time. Derived from one or more source records via reconciliation. Episodes represent continuous periods of use - a gap beyond threshold creates a new episode."@en ;
    rdfs:subClassOf prov:Entity ;
    rdfs:seeAlso <https://cascadeprotocol.org/docs/clinical/v1.0/episodes/> .

clinical:Supplement a owl:Class ;
    rdfs:label "Supplement"@en ;
    rdfs:comment "Dietary supplement, OTC product, or herbal remedy with explicit regulatory status. Separate from Medication class due to different regulatory status and evidence requirements."@en ;
    rdfs:subClassOf prov:Entity .

# ============================================================================
# Longitudinal Lab Classes (v1.4)
# ============================================================================

clinical:LabTestSeries a owl:Class ;
    rdfs:label "Lab Test Series"@en ;
    rdfs:comment """Longitudinal record of repeated measurements of the same laboratory
        test (identified by LOINC code) over time. Derived from one or more
        clinical:LabResult source records via reconciliation. Carries trending
        analysis, inferred status, and source linkage. The lab equivalent of
        MedicationUseEpisode. Unlike medication episodes where a 90-day gap
        creates a new episode, lab tests have no gap concept — one series per
        LOINC code per patient."""@en ;
    rdfs:subClassOf prov:Entity ;
    rdfs:seeAlso <https://cascadeprotocol.org/docs/clinical/v1.0/lab-series/> .

# ============================================================================
# Coverage Record Class (v1.5)
# ============================================================================

clinical:CoverageRecord a owl:Class ;
    rdfs:label "Coverage Record"@en ;
    rdfs:comment "DEPRECATED (v1.5+): Use coverage:InsurancePlan from coverage.ttl for new insurance data. This class remains for backward compatibility with existing EHR import pipeline data. Insurance coverage record imported from EHR. Layer 2 representation of patient insurance data with FHIR Coverage alignment."@en ;
    rdfs:subClassOf prov:Entity ;
    rdfs:seeAlso fhir:Coverage ;
    owl:deprecated "true"^^xsd:boolean ;
    cascade:subConcern "deprecated" .

# ============================================================================
# Data Properties - LabTestSeries (v1.4)
# ============================================================================

# --- Identity ---

clinical:canonicalTestName a owl:DatatypeProperty ;
    rdfs:label "Canonical Test Name"@en ;
    rdfs:comment "Normalized test name for the lab test series (e.g., 'Hemoglobin A1C')"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:testLoincCode a owl:DatatypeProperty ;
    rdfs:label "Test LOINC Code"@en ;
    rdfs:comment "LOINC code identifying this test series (e.g., '4548-4' for HbA1c). All results in the series share this code."@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:testConceptUri a owl:ObjectProperty ;
    rdfs:label "Test Concept URI"@en ;
    rdfs:comment "Stable LOINC IRI for the test (e.g., loinc:4548-4). Enables linked-data interoperability."@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range rdfs:Resource .

clinical:seriesCategory a owl:DatatypeProperty ;
    rdfs:label "Series Category"@en ;
    rdfs:comment "Lab category for the series (e.g., hematology, metabolic, lipid, thyroid). Maps to observation-category vocabulary."@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

# --- Longitudinal Tracking ---

clinical:firstResultDate a owl:DatatypeProperty ;
    rdfs:label "First Result Date"@en ;
    rdfs:comment "Earliest clinical date from any source result in this series"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:dateTime .

clinical:lastResultDate a owl:DatatypeProperty ;
    rdfs:label "Last Result Date"@en ;
    rdfs:comment "Most recent clinical date from any source result in this series"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:dateTime .

clinical:resultCount a owl:DatatypeProperty ;
    rdfs:label "Result Count"@en ;
    rdfs:comment "Number of individual results in this series"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:integer .

# --- Current State (Most Recent Result) ---

clinical:latestValue a owl:DatatypeProperty ;
    rdfs:label "Latest Value"@en ;
    rdfs:comment "Value of the most recent result in the series"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:latestUnit a owl:DatatypeProperty ;
    rdfs:label "Latest Unit"@en ;
    rdfs:comment "Unit of the most recent result (UCUM code)"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:latestInterpretation a owl:DatatypeProperty ;
    rdfs:label "Latest Interpretation"@en ;
    rdfs:comment "Interpretation code of the most recent result (FHIR v3-ObservationInterpretation: H, L, N, HH, LL, A, AA)"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

# --- Trend Inference ---

clinical:trendDirection a owl:DatatypeProperty ;
    rdfs:label "Trend Direction"@en ;
    rdfs:comment "Inferred trend direction: increasing, decreasing, stable, or insufficient_data"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:trendConfidence a owl:DatatypeProperty ;
    rdfs:label "Trend Confidence"@en ;
    rdfs:comment "Confidence in the trend inference: high, medium, or low"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:trendReason a owl:DatatypeProperty ;
    rdfs:label "Trend Reason"@en ;
    rdfs:comment "Explainable reason for the trend inference (e.g., '3-point upward trend over 18 months')"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

# --- Abnormal History ---

clinical:hasAbnormalHistory a owl:DatatypeProperty ;
    rdfs:label "Has Abnormal History"@en ;
    rdfs:comment "Whether any result in the series was interpreted as abnormal or critical"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:boolean .

# --- Current Reference Range ---

clinical:currentReferenceRange a owl:DatatypeProperty ;
    rdfs:label "Current Reference Range"@en ;
    rdfs:comment "Most recent reference range text (e.g., '4.0-5.6 %')"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:string .

clinical:currentReferenceRangeLow a owl:DatatypeProperty ;
    rdfs:label "Current Reference Range Low"@en ;
    rdfs:comment "Lower bound of the most recent reference range"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:decimal .

clinical:currentReferenceRangeHigh a owl:DatatypeProperty ;
    rdfs:label "Current Reference Range High"@en ;
    rdfs:comment "Upper bound of the most recent reference range"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range xsd:decimal .

# --- Panel Membership ---

clinical:seriesPanelMembership a owl:ObjectProperty ;
    rdfs:label "Series Panel Membership"@en ;
    rdfs:comment "Reference to a panel (e.g., CMP, CBC) this test series is typically part of"@en ;
    rdfs:domain clinical:LabTestSeries ;
    rdfs:range rdfs:Resource .

# Note: derivedFromRecord, sourceExternalId, and hasUnresolvedConflicts are
# reused from MedicationUseEpisode (domains broadened in v1.4 to apply to
# all longitudinal record types).

# ============================================================================
# Data Properties - CoverageRecord (v1.5)
# ============================================================================

clinical:providerName a owl:DatatypeProperty ;
    rdfs:label "Provider Name"@en ;
    rdfs:comment "Insurance company or plan provider name."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:memberId a owl:DatatypeProperty ;
    rdfs:label "Member ID"@en ;
    rdfs:comment "Insurance member/subscriber identifier."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:groupNumber a owl:DatatypeProperty ;
    rdfs:label "Group Number"@en ;
    rdfs:comment "Employer group number for employer-sponsored plans."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:planName a owl:DatatypeProperty ;
    rdfs:label "Plan Name"@en ;
    rdfs:comment "Name of the insurance plan."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:planType a owl:DatatypeProperty ;
    rdfs:label "Plan Type"@en ;
    rdfs:comment "Type of insurance plan: hmo, ppo, epo, pos, hdhp, medicare, medicaid, tricare, other."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:coverageType a owl:DatatypeProperty ;
    rdfs:label "Coverage Type"@en ;
    rdfs:comment "Classification of coverage: medical, dental, vision, prescription, mental_health."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:relationship a owl:DatatypeProperty ;
    rdfs:label "Relationship"@en ;
    rdfs:comment "Beneficiary relationship to subscriber: self, spouse, child, parent, other."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:effectivePeriodStart a owl:DatatypeProperty ;
    rdfs:label "Effective Period Start"@en ;
    rdfs:comment "Start date of coverage period."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:date .

clinical:effectivePeriodEnd a owl:DatatypeProperty ;
    rdfs:label "Effective Period End"@en ;
    rdfs:comment "End date of coverage period."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:date .

clinical:payorName a owl:DatatypeProperty ;
    rdfs:label "Payor Name"@en ;
    rdfs:comment "Name of the organization paying for coverage."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

clinical:subscriberId a owl:DatatypeProperty ;
    rdfs:label "Subscriber ID"@en ;
    rdfs:comment "Identifier for the policy holder from the insurer."@en ;
    rdfs:domain clinical:CoverageRecord ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Document Metadata
# ============================================================================

clinical:importedAt a owl:DatatypeProperty ;
    rdfs:label "Imported At"@en ;
    rdfs:comment "ISO 8601 timestamp when document was imported from Apple Health"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:dateTime .

clinical:sourceEHR a owl:DatatypeProperty ;
    rdfs:label "Source EHR"@en ;
    rdfs:comment "Name of the source EHR system (e.g., 'Epic MyChart', 'Cerner'). Applicable to ClinicalDocument, LabResult, and other EHR-sourced records."@en ;
    rdfs:range xsd:string .

clinical:sourceBundleId a owl:DatatypeProperty ;
    rdfs:label "Source Bundle ID"@en ;
    rdfs:comment "iOS app bundle identifier of the source (e.g., 'com.epic.mychart')"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

clinical:fhirResourceId a owl:DatatypeProperty ;
    rdfs:label "FHIR Resource ID"@en ;
    rdfs:comment "Original FHIR resource identifier from the source system"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

clinical:fhirResourceType a owl:DatatypeProperty ;
    rdfs:label "FHIR Resource Type"@en ;
    rdfs:comment "FHIR resource type (e.g., 'DiagnosticReport', 'Composition')"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

clinical:documentDate a owl:DatatypeProperty ;
    rdfs:label "Document Date"@en ;
    rdfs:comment "Date the clinical document was created in the EHR"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:dateTime .

clinical:encounterDate a owl:DatatypeProperty ;
    rdfs:label "Encounter Date"@en ;
    rdfs:comment "Date of the clinical encounter this document relates to"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:dateTime .

clinical:displayName a owl:DatatypeProperty ;
    rdfs:label "Display Name"@en ;
    rdfs:comment "Human-readable display name from the EHR"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Narrative Content
# ============================================================================

clinical:narrativeText a owl:DatatypeProperty ;
    rdfs:label "Narrative Text"@en ;
    rdfs:comment "Plain text extracted from FHIR text.div element (HTML tags stripped)"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

clinical:narrativeXHTML a owl:DatatypeProperty ;
    rdfs:label "Narrative XHTML"@en ;
    rdfs:comment "Original XHTML content from FHIR Narrative element"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:string .

clinical:rawFHIRData a owl:DatatypeProperty ;
    rdfs:label "Raw FHIR Data"@en ;
    rdfs:comment "Base64-encoded original FHIR JSON/XML for lossless preservation"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range xsd:base64Binary .

# ============================================================================
# Object Properties - Sections
# ============================================================================

clinical:hasSection a owl:ObjectProperty ;
    rdfs:label "Has Section"@en ;
    rdfs:comment "Links a clinical document to its component sections"@en ;
    rdfs:domain clinical:ClinicalDocument ;
    rdfs:range clinical:ClinicalSection .

clinical:sectionCode a owl:DatatypeProperty ;
    rdfs:label "Section Code"@en ;
    rdfs:comment "LOINC code identifying the section type"@en ;
    rdfs:domain clinical:ClinicalSection ;
    rdfs:range xsd:string .

clinical:sectionTitle a owl:DatatypeProperty ;
    rdfs:label "Section Title"@en ;
    rdfs:comment "Human-readable section title (e.g., 'History of Present Illness')"@en ;
    rdfs:domain clinical:ClinicalSection ;
    rdfs:range xsd:string .

clinical:sectionContent a owl:DatatypeProperty ;
    rdfs:label "Section Content"@en ;
    rdfs:comment "Plain text content of the section"@en ;
    rdfs:domain clinical:ClinicalSection ;
    rdfs:range xsd:string .

clinical:sectionOrder a owl:DatatypeProperty ;
    rdfs:label "Section Order"@en ;
    rdfs:comment "Integer indicating section order within the document"@en ;
    rdfs:domain clinical:ClinicalSection ;
    rdfs:range xsd:integer .

# ============================================================================
# Data Properties - Structured Records (Shared)
# ============================================================================

clinical:recordDate a owl:DatatypeProperty ;
    rdfs:label "Record Date"@en ;
    rdfs:comment "Date the clinical record was created or observed"@en ;
    rdfs:range xsd:dateTime .

clinical:status a owl:DatatypeProperty ;
    rdfs:label "Status"@en ;
    rdfs:comment """Lifecycle status of the record. Permitted values depend on the record class and are constrained per-shape, not on this property.

INTENDED VALUE SETS (FHIR R4). Recorded here in v1.13 because they are only partly enforced, and the gap should be visible in the vocabulary rather than only in the shapes:

  clinical:Immunization   ImmunizationStatusCodes    completed | entered-in-error | not-done
                          -- ENFORCED by clinical:ImmunizationShape
  clinical:Procedure      EventStatus
                          -- ENFORCED by clinical:ProcedureShape
  clinical:Medication     MedicationRequest.status   active | on-hold | cancelled | completed |
                                                     entered-in-error | stopped | draft | unknown
                          -- NOT ENFORCED by clinical:MedicationShape

The omission on medications is deliberate as of v1.13, not an oversight. Emitted data uses at least one value outside the FHIR set ("discontinued"; the FHIR equivalents are "stopped" and "ended"), so adding sh:in would be a BREAKING change for existing pods, not a clarification: records that validate today would start failing without any emitter having been corrected first. The ordered fix is to map emitters onto the FHIR value set, then add the constraint in a release explicitly flagged as tightening."""@en ;
    rdfs:seeAlso <https://hl7.org/fhir/R4/valueset-medicationrequest-status.html> ;
    rdfs:range xsd:string .

clinical:loincCode a owl:DatatypeProperty ;
    rdfs:label "LOINC Code"@en ;
    rdfs:comment "LOINC code for the clinical concept"@en ;
    rdfs:range xsd:string .

clinical:snomedCode a owl:DatatypeProperty ;
    rdfs:label "SNOMED Code"@en ;
    rdfs:comment "SNOMED CT code for the clinical concept"@en ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Medication
# ============================================================================

clinical:drugName a owl:DatatypeProperty ;
    rdfs:label "Drug Name"@en ;
    rdfs:comment "Name of the medication"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:dosage a owl:DatatypeProperty ;
    rdfs:label "Dosage"@en ;
    rdfs:comment "Dosage information for the medication"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:route a owl:DatatypeProperty ;
    rdfs:label "Route"@en ;
    rdfs:comment "Route of administration (oral, IV, etc.)"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:frequency a owl:DatatypeProperty ;
    rdfs:label "Frequency"@en ;
    rdfs:comment "How often medication is taken"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:rxNormCode a owl:DatatypeProperty ;
    rdfs:label "RxNorm Code"@en ;
    rdfs:comment "RxNorm code for the medication"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:ndcCode a owl:DatatypeProperty ;
    rdfs:label "NDC Code"@en ;
    rdfs:comment "National Drug Code for the medication"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:prescriber a owl:DatatypeProperty ;
    rdfs:label "Prescriber"@en ;
    rdfs:comment "Name of the prescribing physician"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:indication a owl:DatatypeProperty ;
    rdfs:label "Indication"@en ;
    rdfs:comment "Clinical reason for the medication (why prescribed)"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:courseOfTherapyType a owl:DatatypeProperty ;
    rdfs:label "Course of Therapy Type"@en ;
    rdfs:comment "Prescribing workflow classification: acute (one-time/short), continuous (ongoing), or unknown"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:asNeeded a owl:DatatypeProperty ;
    rdfs:label "As Needed (PRN)"@en ;
    rdfs:comment "Whether medication is taken as needed rather than on a fixed schedule"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:boolean .

clinical:medicationForm a owl:DatatypeProperty ;
    rdfs:label "Medication Form"@en ;
    rdfs:comment "Physical form of the medication (tablet, capsule, liquid, injection, etc.)"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:activeIngredient a owl:DatatypeProperty ;
    rdfs:label "Active Ingredient"@en ;
    rdfs:comment "Primary active ingredient name"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:ingredientStrength a owl:DatatypeProperty ;
    rdfs:label "Ingredient Strength"@en ;
    rdfs:comment "Strength of the active ingredient (e.g. '5 mg per tablet')"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:provenanceClass a owl:DatatypeProperty ;
    rdfs:label "Provenance Class"@en ;
    rdfs:comment "Source classification for editability: healthKitFHIR, userTracked, pharmacyClaim, or imported. Applicable to Medication, LabResult, and other clinical records."@en ;
    rdfs:range xsd:string .

clinical:sourceFhirResourceType a owl:DatatypeProperty ;
    rdfs:label "Source FHIR Resource Type"@en ;
    rdfs:comment "Which FHIR resource type this record originated from"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:clinicalIntent a owl:DatatypeProperty ;
    rdfs:label "Clinical Intent"@en ;
    rdfs:comment "Clinical intent derived from source: reportedUse, prescribed, dispensed, or administered"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:refillsAllowed a owl:DatatypeProperty ;
    rdfs:label "Refills Allowed"@en ;
    rdfs:comment "Number of prescription refills authorized"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:integer .

clinical:supplyDurationDays a owl:DatatypeProperty ;
    rdfs:label "Supply Duration Days"@en ;
    rdfs:comment "Number of days each fill is intended to supply"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:integer .

clinical:dispensedQuantity a owl:DatatypeProperty ;
    rdfs:label "Dispensed Quantity"@en ;
    rdfs:comment "Quantity dispensed per fill (e.g. '90 tablets')"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:prescriptionCategory a owl:DatatypeProperty ;
    rdfs:label "Prescription Category"@en ;
    rdfs:comment "Prescribing context: community, inpatient, or discharge"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:administrationRoute a owl:DatatypeProperty ;
    rdfs:label "Administration Route"@en ;
    rdfs:comment "Route of administration: oral, intravenous, subcutaneous, intramuscular, topical, inhaled, etc."@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Allergy
# ============================================================================

clinical:allergen a owl:DatatypeProperty ;
    rdfs:label "Allergen"@en ;
    rdfs:comment "Name of the allergen or substance"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

clinical:reaction a owl:DatatypeProperty ;
    rdfs:label "Reaction"@en ;
    rdfs:comment "Description of the allergic reaction"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

clinical:severity a owl:DatatypeProperty ;
    rdfs:label "Severity"@en ;
    rdfs:comment "Severity of the allergy (mild, moderate, severe)"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

clinical:allergyCategory a owl:DatatypeProperty ;
    rdfs:label "Allergy Category"@en ;
    rdfs:comment "Category of allergy (food, medication, environment, biologic)"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

clinical:criticality a owl:DatatypeProperty ;
    rdfs:label "Criticality"@en ;
    rdfs:comment "Potential clinical harm (low, high, unable-to-assess)"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Lab Result
# ============================================================================

clinical:testName a owl:DatatypeProperty ;
    rdfs:label "Test Name"@en ;
    rdfs:comment "Name of the laboratory test"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:value a owl:DatatypeProperty ;
    rdfs:label "Value"@en ;
    rdfs:comment "Numeric or string value of the result"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:unit a owl:DatatypeProperty ;
    rdfs:label "Unit"@en ;
    rdfs:comment "Unit of measurement for the value"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:referenceRange a owl:DatatypeProperty ;
    rdfs:label "Reference Range"@en ;
    rdfs:comment "Normal reference range for the test"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:interpretation a owl:DatatypeProperty ;
    rdfs:label "Interpretation"@en ;
    rdfs:comment """Categorical reading of an observation against its reference range, as a code from the HL7 v3 ObservationInterpretation code system, the code system FHIR R4 binds Observation.interpretation to. Any of the 15 data-absent-reason codes is also accepted, for a source whose interpretation element was absent or null-flavoured. The ten English words of the pre-v1.14 enum are retained so older data keeps validating and are not recommended for new writes.

ONE VALUE SET ACROSS BOTH OBSERVATION SHAPES, as of v1.15. Through v1.14, clinical:LabResultShape bound this property with sh:in and clinical:VitalSignShape did not, so the same predicate on the same kind of value was checked on labs and unchecked on vitals. That gap was recorded as intentional because emitted vital data used "elevated", which is in neither ratified set, and constraining vitals would have failed those records. v1.15 closes it the way core v3.5 wrote down for exactly this situation: the value set is applied to clinical:VitalSignShape at sh:Warning, not sh:Violation, so the records that carry a non-ratified word are reported rather than rejected, and it is raised to sh:Violation in a later clinical version only after a release in which the warning is observably absent from conforming output. "elevated" migrates to the ratified code plus a verbatim clinical:interpretationSourceCode.

A source code in NEITHER value set is carried verbatim on clinical:interpretationSourceCode rather than being forced into this property or dropped."""@en ;
    rdfs:seeAlso <http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation> ;
    rdfs:seeAlso <http://terminology.hl7.org/CodeSystem/data-absent-reason> ;
    rdfs:seeAlso <https://hl7.org/fhir/R4/valueset-observation-interpretation.html> ;
    rdfs:range xsd:string .

clinical:interpretationSourceCode a owl:DatatypeProperty ;
    rdfs:label "Interpretation Source Code"@en ;
    rdfs:comment """The interpretation code the SOURCE wrote, copied verbatim, for the case where that code is a member of neither value set clinical:interpretation is bound to (HL7 v3 ObservationInterpretation, and data-absent-reason). Kept semantically identical to health:interpretationSourceCode, for the reason recorded on the interpretation shapes: these are two spellings of one record, and letting them drift is how one spelling silently becomes the lenient one.

WRITE IT ONLY THEN. A code that IS in one of the bound value sets belongs on clinical:interpretation and must not be duplicated here.

It is deliberately unconstrained: no value set, no pattern, no case folding. A producer that recognises the source code's intent should ALSO write its nearest ratified equivalent on clinical:interpretation, so a consumer reading only the bound property still gets a usable reading."""@en ;
    rdfs:range xsd:string ;
    rdfs:seeAlso clinical:interpretation ;
    rdfs:seeAlso health:interpretationSourceCode ;
    owl:versionInfo "Added in clinical v1.15" .

clinical:specimenType a owl:DatatypeProperty ;
    rdfs:label "Specimen Type"@en ;
    rdfs:comment "Type of specimen collected (blood, urine, etc.)"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Condition
# ============================================================================

clinical:conditionName a owl:DatatypeProperty ;
    rdfs:label "Condition Name"@en ;
    rdfs:comment "Name of the medical condition or diagnosis"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:string .

clinical:onsetDate a owl:DatatypeProperty ;
    rdfs:label "Onset Date"@en ;
    rdfs:comment "Date when the condition began"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:dateTime .

clinical:abatementDate a owl:DatatypeProperty ;
    rdfs:label "Abatement Date"@en ;
    rdfs:comment "Date when the condition resolved"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:dateTime .

clinical:clinicalStatus a owl:DatatypeProperty ;
    rdfs:label "Clinical Status"@en ;
    rdfs:comment "Clinical status (active, recurrence, relapse, inactive, remission, resolved)"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:string .

clinical:verificationStatus a owl:DatatypeProperty ;
    rdfs:label "Verification Status"@en ;
    rdfs:comment "Verification status (unconfirmed, provisional, differential, confirmed, refuted)"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:string .

clinical:icd10Code a owl:DatatypeProperty ;
    rdfs:label "ICD-10 Code"@en ;
    rdfs:comment "ICD-10-CM diagnosis code"@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:string .

clinical:linkedConditionIds a owl:DatatypeProperty ;
    rdfs:label "Linked Condition IDs"@en ;
    rdfs:comment "DEPRECATED (v1.10): use the clinical:linkedCondition ObjectProperty instead, which links to related conditions by IRI and is traversable RDF. This property encoded links as space-separated UUIDs in a single literal, which no graph query can follow. Retained for backward compatibility with existing Checkup data that may carry it; not emitted for new data."@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range xsd:string ;
    owl:deprecated "true"^^xsd:boolean ;
    rdfs:seeAlso clinical:linkedCondition .

# ============================================================================
# Data Properties - Immunization
# ============================================================================

clinical:vaccineName a owl:DatatypeProperty ;
    rdfs:label "Vaccine Name"@en ;
    rdfs:comment "Name of the vaccine administered"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:vaccineCode a owl:DatatypeProperty ;
    rdfs:label "Vaccine Code"@en ;
    rdfs:comment "CVX code for the vaccine (legacy — use clinical:cvxCode for new serialization; v1.6)"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:lotNumber a owl:DatatypeProperty ;
    rdfs:label "Lot Number"@en ;
    rdfs:comment "Vaccine lot number"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:site a owl:DatatypeProperty ;
    rdfs:label "Site"@en ;
    rdfs:comment "Body site where vaccine was administered"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:doseNumber a owl:DatatypeProperty ;
    rdfs:label "Dose Number"@en ;
    rdfs:comment "Dose number in a series (e.g., 1, 2, booster)"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:manufacturer a owl:DatatypeProperty ;
    rdfs:label "Manufacturer"@en ;
    rdfs:comment "Vaccine manufacturer"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:expirationDate a owl:DatatypeProperty ;
    rdfs:label "Expiration Date"@en ;
    rdfs:comment "Vaccine expiration date"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:date .

# ============================================================================
# Data Properties - Procedure
# ============================================================================

clinical:procedureName a owl:DatatypeProperty ;
    rdfs:label "Procedure Name"@en ;
    rdfs:comment """Name of the procedure performed. This is the CANONICAL and only defined spelling: it is the property whose rdfs:domain is clinical:Procedure, the one clinical:ProcedureShape names, and the one the JSON-LD context maps.

THE health: SPELLING IS NOT A SECOND SPELLING (v1.15). A C-CDA import path has been writing the procedure name to a `health:procedureName` predicate that the health vocabulary does not define, on records it types clinical:Procedure. The result was a record that CARRIES a name, fails clinical:ProcedureShape's name requirement as though it had none, and carries that name on a predicate no shape targets, so the name itself is validated by nothing.

This is resolved in favour of clinical:procedureName rather than by blessing the health: spelling, for three reasons. There is no health-namespace procedure vocabulary at all: no health:ProcedureRecord, no health:procedureName, so ratifying the emission would mint an undefined-term family of exactly the kind health v2.5 spent a release eliminating. The record is typed clinical:Procedure, so a health: name predicate on it is a namespace mismatch inside a single record rather than a coherent alternative serialization. And the repository's one dual-spelling precedent, health:DailyVitalReadingShape's sh:or over cascade:date and health:date, exists because BOTH serializations are live and defined; here only one spelling is defined, so that precedent does not reach this case.

MIGRATION, and what a reader must re-query. clinical:ProcedureShape satisfies its name requirement through sh:or over both spellings from v1.15, so a Pod already holding health:procedureName triples stops failing immediately and no data has to be rewritten to become valid. A separate warning-severity shape fires wherever the health: spelling is present. Producers write clinical:procedureName only. Both the sh:or alternative and the warning shape are removed in a later clinical version, once the warning is observably absent from conforming output; each step is its own vocabulary version. A consumer querying health:procedureName must add clinical:procedureName to its query now and can drop the health: term at that later version."""@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string ;
    owl:versionInfo "Canonical spelling restated, and the health: emission given a migration window, in clinical v1.15" .

clinical:procedureDate a owl:DatatypeProperty ;
    rdfs:label "Procedure Date"@en ;
    rdfs:comment "Date when the procedure was performed"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:dateTime .

clinical:bodySite a owl:DatatypeProperty ;
    rdfs:label "Body Site"@en ;
    rdfs:comment "Body site where procedure was performed"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:performer a owl:DatatypeProperty ;
    rdfs:label "Performer"@en ;
    rdfs:comment "Name or identifier of the procedure performer"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:cptCode a owl:DatatypeProperty ;
    rdfs:label "CPT Code"@en ;
    rdfs:comment "CPT procedure code"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:outcome a owl:DatatypeProperty ;
    rdfs:label "Outcome"@en ;
    rdfs:comment "Outcome of the procedure"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:procedureStatus a owl:DatatypeProperty ;
    rdfs:label "Procedure Status"@en ;
    rdfs:comment "FHIR event-status: preparation, in-progress, not-done, on-hold, stopped, completed, entered-in-error, unknown."@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:procedureCategory a owl:DatatypeProperty ;
    rdfs:label "Procedure Category"@en ;
    rdfs:comment "Classification category of the procedure (e.g., surgical, diagnostic, counseling)."@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

clinical:procedureSnomedCode a owl:DatatypeProperty ;
    rdfs:label "Procedure SNOMED Code"@en ;
    rdfs:comment "SNOMED CT concept code for the procedure."@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Vital Sign
# ============================================================================

clinical:vitalType a owl:DatatypeProperty ;
    rdfs:label "Vital Type"@en ;
    rdfs:comment "Type of vital sign (heart_rate, blood_pressure, temperature, etc.)"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:systolicValue a owl:DatatypeProperty ;
    rdfs:label "Systolic Value"@en ;
    rdfs:comment "Systolic blood pressure value"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:decimal .

clinical:diastolicValue a owl:DatatypeProperty ;
    rdfs:label "Diastolic Value"@en ;
    rdfs:comment "Diastolic blood pressure value"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:decimal .

clinical:deviceName a owl:DatatypeProperty ;
    rdfs:label "Device Name"@en ;
    rdfs:comment "Name of the measuring device"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:measurementMethod a owl:DatatypeProperty ;
    rdfs:label "Measurement Method"@en ;
    rdfs:comment "Method used for measurement"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:valueString a owl:DatatypeProperty ;
    rdfs:label "Value String"@en ;
    rdfs:comment "String representation of a value for non-numeric results"@en ;
    rdfs:range xsd:string .

clinical:effectiveDate a owl:DatatypeProperty ;
    rdfs:label "Effective Date"@en ;
    rdfs:comment "Date/time when measurement or observation was taken"@en ;
    rdfs:range xsd:dateTime .

# ============================================================================
# Data Properties - Additional Medication
# ============================================================================

clinical:instructions a owl:DatatypeProperty ;
    rdfs:label "Instructions"@en ;
    rdfs:comment "Patient instructions for taking the medication"@en ;
    rdfs:domain clinical:Medication ;
    rdfs:range xsd:string .

clinical:startDate a owl:DatatypeProperty ;
    rdfs:label "Start Date"@en ;
    rdfs:comment "Start date for medication or treatment"@en ;
    rdfs:range xsd:dateTime .

clinical:endDate a owl:DatatypeProperty ;
    rdfs:label "End Date"@en ;
    rdfs:comment "End date for medication or treatment"@en ;
    rdfs:range xsd:dateTime .

# ============================================================================
# Data Properties - Additional Allergy
# ============================================================================

clinical:allergyType a owl:DatatypeProperty ;
    rdfs:label "Allergy Type"@en ;
    rdfs:comment "Type of allergy (allergy vs intolerance)"@en ;
    rdfs:domain clinical:Allergy ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Additional Lab Result
# ============================================================================

clinical:orderingProvider a owl:DatatypeProperty ;
    rdfs:label "Ordering Provider"@en ;
    rdfs:comment "Name of the clinician who ordered the laboratory test"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:performingLab a owl:DatatypeProperty ;
    rdfs:label "Performing Lab"@en ;
    rdfs:comment "Name of the laboratory that performed the test"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:observationStatus a owl:DatatypeProperty ;
    rdfs:label "Observation Status"@en ;
    rdfs:comment "FHIR observation-status code: final, preliminary, amended, corrected, cancelled, entered-in-error. See http://hl7.org/fhir/observation-status"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:sourceRecordId a owl:DatatypeProperty ;
    rdfs:label "Source Record ID"@en ;
    rdfs:comment "FHIR resource identifier from the source system for traceability"@en ;
    rdfs:range xsd:string .

clinical:panelMembership a owl:ObjectProperty ;
    rdfs:label "Panel Membership"@en ;
    rdfs:comment "Back-reference from an individual lab result to the panel container (e.g., CMP, CBC) it belongs to. Uses fhir:hasMember on the panel side; this is the inverse link on the member side."@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range rdfs:Resource .

clinical:referenceRangeLow a owl:DatatypeProperty ;
    rdfs:label "Reference Range Low"@en ;
    rdfs:comment "Lower bound of normal reference range"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:decimal .

clinical:referenceRangeHigh a owl:DatatypeProperty ;
    rdfs:label "Reference Range High"@en ;
    rdfs:comment "Upper bound of normal reference range"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:decimal .

clinical:referenceRangeText a owl:DatatypeProperty ;
    rdfs:label "Reference Range Text"@en ;
    rdfs:comment "Reference range as descriptive text"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:string .

clinical:issuedDate a owl:DatatypeProperty ;
    rdfs:label "Issued Date"@en ;
    rdfs:comment "Date when the result was issued"@en ;
    rdfs:domain clinical:LabResult ;
    rdfs:range xsd:dateTime .

clinical:category a owl:DatatypeProperty ;
    rdfs:label "Category"@en ;
    rdfs:comment "Category classification of the record"@en ;
    rdfs:range xsd:string .

clinical:notes a owl:DatatypeProperty ;
    rdfs:label "Notes"@en ;
    rdfs:comment "Additional notes or comments"@en ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Additional Immunization
# ============================================================================

clinical:occurrenceDate a owl:DatatypeProperty ;
    rdfs:label "Occurrence Date"@en ;
    rdfs:comment "Date when the immunization was administered"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:dateTime .

clinical:doseQuantity a owl:DatatypeProperty ;
    rdfs:label "Dose Quantity"@en ;
    rdfs:comment "Dose amount administered"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

clinical:cvxCode a owl:DatatypeProperty ;
    rdfs:label "CVX Code"@en ;
    rdfs:comment "CDC CVX vaccine code"@en ;
    rdfs:domain clinical:Immunization ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Additional Procedure
# ============================================================================

clinical:performedDate a owl:DatatypeProperty ;
    rdfs:label "Performed Date"@en ;
    rdfs:comment "Date when the procedure was performed"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:dateTime .

clinical:performedEndDate a owl:DatatypeProperty ;
    rdfs:label "Performed End Date"@en ;
    rdfs:comment "End date for procedures that span a period"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:dateTime .

clinical:location a owl:DatatypeProperty ;
    rdfs:label "Location"@en ;
    rdfs:comment "Location where procedure was performed"@en ;
    rdfs:domain clinical:Procedure ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - Vital Sign Components
# ============================================================================

clinical:component1Name a owl:DatatypeProperty ;
    rdfs:label "Component 1 Name"@en ;
    rdfs:comment "Name of first vital sign component (e.g., Systolic)"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:component1Value a owl:DatatypeProperty ;
    rdfs:label "Component 1 Value"@en ;
    rdfs:comment "Value of first vital sign component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:decimal .

clinical:component1Unit a owl:DatatypeProperty ;
    rdfs:label "Component 1 Unit"@en ;
    rdfs:comment "Unit for first vital sign component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:component1LoincCode a owl:DatatypeProperty ;
    rdfs:label "Component 1 LOINC Code"@en ;
    rdfs:comment "LOINC code for first component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:component2Name a owl:DatatypeProperty ;
    rdfs:label "Component 2 Name"@en ;
    rdfs:comment "Name of second vital sign component (e.g., Diastolic)"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:component2Value a owl:DatatypeProperty ;
    rdfs:label "Component 2 Value"@en ;
    rdfs:comment "Value of second vital sign component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:decimal .

clinical:component2Unit a owl:DatatypeProperty ;
    rdfs:label "Component 2 Unit"@en ;
    rdfs:comment "Unit for second vital sign component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

clinical:component2LoincCode a owl:DatatypeProperty ;
    rdfs:label "Component 2 LOINC Code"@en ;
    rdfs:comment "LOINC code for second component"@en ;
    rdfs:domain clinical:VitalSign ;
    rdfs:range xsd:string .

# ============================================================================
# Data Properties - MedicationUseEpisode (v1.2)
# ============================================================================

clinical:canonicalName a owl:DatatypeProperty ;
    rdfs:label "Canonical Name"@en ;
    rdfs:comment "Normalized drug name for the medication episode"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:episodeFirstSeenDate a owl:DatatypeProperty ;
    rdfs:label "Episode First Seen Date"@en ;
    rdfs:comment "Earliest CLINICAL date from source records (not import time)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:dateTime .

clinical:episodeLastSeenDate a owl:DatatypeProperty ;
    rdfs:label "Episode Last Seen Date"@en ;
    rdfs:comment "Most recent CLINICAL date from source records"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:dateTime .

clinical:currentDose a owl:DatatypeProperty ;
    rdfs:label "Current Dose"@en ;
    rdfs:comment "Current dosage for the medication (most recent from sources)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:currentFrequency a owl:DatatypeProperty ;
    rdfs:label "Current Frequency"@en ;
    rdfs:comment "Current frequency of medication use"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:currentRoute a owl:DatatypeProperty ;
    rdfs:label "Current Route"@en ;
    rdfs:comment "Current route of administration"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:inferredStatus a owl:DatatypeProperty ;
    rdfs:label "Inferred Status"@en ;
    rdfs:comment "Inferred active/inactive status (active, inactive)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:statusConfidence a owl:DatatypeProperty ;
    rdfs:label "Status Confidence"@en ;
    rdfs:comment "Confidence level for inferred status (high, medium, low)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:statusReason a owl:DatatypeProperty ;
    rdfs:label "Status Reason"@en ;
    rdfs:comment "Reason for status inference (explicitStatus, hasRecentEndDate, noRecentActivity, inferredFromRefills, userOverride)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:usePattern a owl:DatatypeProperty ;
    rdfs:label "Use Pattern"@en ;
    rdfs:comment "Pattern of medication use (chronic, shortCourse, oneTime, asNeeded, unknown)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:therapeuticClass a owl:DatatypeProperty ;
    rdfs:label "Therapeutic Class"@en ;
    rdfs:comment "Therapeutic classification from ClinicalClassifier"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:string .

clinical:conceptUri a owl:ObjectProperty ;
    rdfs:label "Concept URI"@en ;
    rdfs:comment "Stable URI for the medication concept (RxNorm URI, NDC URI, or minted Cascade URI)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range rdfs:Resource .

clinical:drugCode a owl:ObjectProperty ;
    rdfs:label "Drug Code"@en ;
    rdfs:comment "Drug code URI from any terminology system (RxNorm, NDC, SNOMED, ATC)"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range rdfs:Resource .

clinical:derivedFromRecord a owl:ObjectProperty ;
    rdfs:label "Derived From Record"@en ;
    rdfs:comment "Links a longitudinal record (MedicationUseEpisode or LabTestSeries) to the source record(s) it was derived from"@en ;
    rdfs:range prov:Entity ;
    rdfs:subPropertyOf prov:wasDerivedFrom .

clinical:sourceExternalId a owl:DatatypeProperty ;
    rdfs:label "Source External ID"@en ;
    rdfs:comment "External identifier from source system (FHIR resource ID, claim ID, etc.). Applicable to MedicationUseEpisode, LabTestSeries, and other longitudinal records."@en ;
    rdfs:range xsd:string .

clinical:hasUnresolvedConflicts a owl:DatatypeProperty ;
    rdfs:label "Has Unresolved Conflicts"@en ;
    rdfs:comment "Flag indicating longitudinal record has data conflicts requiring user attention. Applicable to MedicationUseEpisode and LabTestSeries."@en ;
    rdfs:range xsd:boolean .

clinical:durationDays a owl:DatatypeProperty ;
    rdfs:label "Duration Days"@en ;
    rdfs:comment "Duration of the episode in days"@en ;
    rdfs:domain clinical:MedicationUseEpisode ;
    rdfs:range xsd:integer .

# ============================================================================
# Data Properties - Supplement (v1.2)
# ============================================================================

clinical:supplementName a owl:DatatypeProperty ;
    rdfs:label "Supplement Name"@en ;
    rdfs:comment "Name of the supplement or OTC product"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:regulatoryStatus a owl:DatatypeProperty ;
    rdfs:label "Regulatory Status"@en ;
    rdfs:comment "Regulatory classification (dietarySupplement, otcDrug, homeopathic, herbalRemedy, unknown)"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:evidenceStrength a owl:DatatypeProperty ;
    rdfs:label "Evidence Strength"@en ;
    rdfs:comment "Level of clinical evidence (strongEvidence, moderateEvidence, limitedEvidence, traditionalUse, noEvidence, unknown)"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:brand a owl:DatatypeProperty ;
    rdfs:label "Brand"@en ;
    rdfs:comment "Brand name of the supplement"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:form a owl:DatatypeProperty ;
    rdfs:label "Form"@en ;
    rdfs:comment "Physical form (capsule, tablet, softgel, liquid, powder, gummy, spray, patch, tea, tincture, other)"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:dsldId a owl:DatatypeProperty ;
    rdfs:label "DSLD ID"@en ;
    rdfs:comment "NIH Dietary Supplement Label Database identifier"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:upc a owl:DatatypeProperty ;
    rdfs:label "UPC"@en ;
    rdfs:comment "Universal Product Code (barcode)"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:reasonForUse a owl:DatatypeProperty ;
    rdfs:label "Reason For Use"@en ;
    rdfs:comment "User-provided reason for taking the supplement"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range xsd:string .

clinical:cascadeUri a owl:ObjectProperty ;
    rdfs:label "Cascade URI"@en ;
    rdfs:comment "Stable Cascade Protocol identifier for the supplement"@en ;
    rdfs:domain clinical:Supplement ;
    rdfs:range rdfs:Resource .

clinical:dose a owl:DatatypeProperty ;
    rdfs:label "Dose"@en ;
    rdfs:comment "Dosage amount"@en ;
    rdfs:range xsd:string .

clinical:isActive a owl:DatatypeProperty ;
    rdfs:label "Is Active"@en ;
    rdfs:comment "Whether the medication/supplement is currently active"@en ;
    rdfs:range xsd:boolean .

# ============================================================================
# Alignment with Healthcare Standards
# ============================================================================

# LOINC Document Type Mappings (from C-CDA)
# - Progress note: loinc:11506-3
# - Discharge summary: loinc:18842-5
# - Consultation note: loinc:11488-4
# - History and physical: loinc:34117-2
# - Procedure note: loinc:28570-0

# LOINC Section Codes (common C-CDA sections)
# - Chief complaint: loinc:10154-3
# - History of present illness: loinc:10164-2
# - Past medical history: loinc:11348-0
# - Medications: loinc:10160-0
# - Allergies: loinc:48765-2
# - Assessment: loinc:51848-0
# - Plan: loinc:18776-5
# - Results: loinc:30954-2

# SNOMED CT Mappings
# - Clinical finding: sct:404684003
# - Clinical document: sct:734163000

# ============================================================================
# Changelog
# ============================================================================
#
# Version 1.15 (2026-08-14)
# - ONE new property, clinical:interpretationSourceCode: the source's verbatim
#   interpretation code, written only when that code is a member of neither
#   value set clinical:interpretation is bound to. Kept semantically identical
#   to health:interpretationSourceCode (health v2.7). The alternative
#   considered and rejected was accepting the loss with a warning: a closed
#   value set plus a lossy importer means a laboratory's local flag is either
#   dropped or written into a field that then fails, and either way the Pod can
#   no longer answer what the source actually said.
# - clinical:VitalSignShape's interpretation is bound to the same value set the
#   lab shapes use, at sh:Warning. Through v1.14 the lab shapes carried the
#   sh:in and the vital shape carried none, so the identical predicate was
#   checked on one record type and unchecked on the other. sh:Warning first,
#   sh:Violation in a later version once the warning is observably absent from
#   conforming output, is the ratchet core v3.5 wrote down for precisely this
#   case: a value that existing data carries is reported, not rejected.
# - clinical:interpretation's value set (both shapes) gains the fourteen
#   data-absent-reason codes it did not already carry. v1.14 accepted "unknown"
#   alone, which made every reason for an absent interpretation identical; a
#   C-CDA nullFlavor of NASK, ASKU and NAV are three different clinical facts.
#   Byte-identical to the health:interpretation list, as before.
# - clinical:ProcedureShape's name requirement moves from a bare sh:minCount on
#   clinical:procedureName to an sh:or over clinical:procedureName and the
#   undefined health:procedureName that a C-CDA import path emits, plus a
#   warning-severity shape that fires on the health: spelling. This is a
#   MIGRATION WINDOW, not a ratified dual spelling; the rationale, the ratchet
#   out of it, and what a consumer must re-query are stated on
#   clinical:procedureName above. Every previously-valid graph stays valid and
#   a class of graph that was failing for carrying a name now passes.
# - COMPATIBILITY. Additive and strictly widening. Every graph that validated
#   under v1.14 validates under v1.15 at the same severity, with one deliberate
#   exception at sh:Warning only: a vital sign carrying an interpretation
#   outside the ratified set is now reported. No Violation is added anywhere.
#
# Version 1.14 (2026-08-08)
# - SHACL only; no class or property added, removed, renamed or deprecated.
#   Aligns four constraint families to the ratified standards they describe, and
#   shapes a class that had no shape. Full detail in clinical.shapes.ttl's own
#   changelog; summarised here because the version number lives in this file.
# - clinical:interpretation bound to the HL7 v3 ObservationInterpretation code
#   system (http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation,
#   version 3.0.0), the code system FHIR R4 binds Observation.interpretation to,
#   plus the data-absent-reason code "unknown"
#   (http://terminology.hl7.org/CodeSystem/data-absent-reason). The previous
#   five-member enum was invented here; real exports carry susceptibility,
#   detection, reactivity and change codes that have no member of it.
# - clinical:snomedCode and clinical:icd10Code made multi-valued, per FHIR R4
#   CodeableConcept.coding 0..*
#   (https://hl7.org/fhir/R4/datatypes.html#CodeableConcept).
# - clinical:cptCode pattern widened from five digits to the full AMA CPT code
#   set structure: five digits (Category I) or four digits plus F, T or U
#   (Category II, Category III, Proprietary Laboratory Analyses).
# - Source-carried date properties (encounterDate, documentDate, onsetDate,
#   procedureDate) now accept xsd:date alongside xsd:dateTime, because FHIR's
#   dateTime primitive is explicitly partial-precision
#   (https://build.fhir.org/datatypes.html) and C-CDA effectiveTime is commonly
#   date-precision. Cascade-generated timestamps are unchanged.
# - Added clinical:EncounterShape and clinical:EncounterTemporalShape.
#   clinical:Encounter has been defined since v1.7 and targeted by no shape, so
#   validating an encounter checked nothing and returned PASS. Encounters vary
#   widely, so the shape constrains cardinality, datatype, provenance and the
#   IRI requirement that clinical:hasEncounter implies, and leaves the kind of
#   visit unconstrained.
#
# Version 1.13 (2026-08-03)
# - Deprecated 4 classes: clinical:LabResult, clinical:Condition,
#   clinical:Allergy, clinical:Immunization. Each carries owl:deprecated true
#   and rdfs:seeAlso pointing at its health: equivalent, which is the type
#   every import path already emits and which health v2.5 now defines and
#   shapes. NOT removed: the pod export path remains the sole emitter of these
#   four classes, and existing pods contain them. Readers must accept both
#   spellings; writers should prefer the health: forms. No emitter changed in
#   this release.
# - Documented the intended FHIR R4 value sets on clinical:status and
#   clinical:interpretation, and recorded WHY two of them are not enforced.
#   clinical:MedicationShape has no sh:in on status and clinical:VitalSignShape
#   has none on interpretation, while the sibling shapes do. Emitted data uses
#   "discontinued" for medication status and "elevated" for vital-sign
#   interpretation, neither of which is in the corresponding constrained set,
#   so adding the constraints would be breaking for existing pods rather than
#   clarifying. The gap is now stated in the vocabulary instead of being
#   visible only as an absence in the shapes.
# - Added clinical:ConsultationNoteShape. clinical:ConsultationNote is one of
#   six rdfs:subClassOf clinical:ClinicalDocument; the other five each carry an
#   explicit sh:targetClass and this one did not. A subclass axiom does not
#   inherit a shape (SHACL resolves sh:targetClass over SHACL-instances in the
#   DATA graph, so an axiom in this file does not expand the target set), so
#   consultation notes were validating vacuously while every sibling document
#   type was checked. Consequence: a consultation note missing importedAt,
#   sourceEHR or fhirResourceId passed before and fails now.
#
# Version 1.12 (2026-07-20)
# - Added clinical:parsedIndicationReference ObjectProperty, a
#   rdfs:subPropertyOf clinical:indicationReference. Records an indication edge
#   the importer DERIVED by parsing a coded/free-text reason on the record
#   (FHIR reasonCode, or a clinical:indication / clinical:reasonForUse literal)
#   and matching it to a condition record in the same pod, as distinct from
#   clinical:indicationReference proper, which restates an explicit
#   reasonReference the source carried. Modeled as a subproperty so traversal
#   over the superproperty returns both families while the predicate remains
#   the machine-readable basis label; no reification and no RDF-star, keeping
#   the edge a plain triple every existing consumer can already read.
#   Motivation (M1 literal-lifting census, 2026-07-20): a real Apple Health
#   provider export carried 0 reasonReference but 50 reasonCode instances on
#   medication/procedure records, 25 of which resolve unambiguously to a
#   condition record by exact coding identity. Those relations are dropped
#   entirely today. Matching is code-first with a normalized-name fallback and
#   unambiguous-only; ambiguous/unmatched are counted, never guessed.
#   Deliberately NOT modeled with a confidence score: this is a deterministic
#   parse of what the record says, not structural/temporal inference (which
#   stays out of the pod and is computed at query time).
#
# Version 1.11 (2026-07-16)
# - Widened clinical:indicationReference: dropped the restrictive
#   rdfs:domain clinical:Medication in favor of the broad-domain comment +
#   SHACL pattern the other cross-class edges already use. Reason: FHIR carries
#   reasonReference on Procedure, MedicationRequest, MedicationAdministration,
#   Encounter, and other event resources, not only medications. The importer
#   (slice R3) materializes indication edges from Procedure (the common case in
#   Synthea) and MedicationAdministration as well as MedicationRequest; the old
#   domain would have made an OWL reasoner infer those Procedures are Medications.
#   No SHACL change: IndicationReferenceEdgeShape never encoded the domain (it
#   only checks sh:nodeKind sh:IRI), so existing pods are unaffected and the edge
#   was already valid data. Purely a vocabulary-correctness fix.
#
# Version 1.10 (2026-07-16)
# - Added clinical:hasEncounter ObjectProperty (range clinical:Encounter). The
#   record-to-encounter edge for grouping clinical events by visit context.
#   FHIR alignment: the .encounter Reference(Encounter) element on Observation,
#   MedicationRequest, Condition, Procedure, DiagnosticReport, DocumentReference.
#   Domain left broad (comment + SHACL, no restrictive rdfs:domain union).
# - Added clinical:indicationReference ObjectProperty (range rdfs:Resource). The
#   medication-to-condition indication edge alongside the retained free-text
#   clinical:indication / clinical:reasonForUse literals. FHIR alignment:
#   MedicationRequest.reasonReference (R4; reason CodeableReference in R5).
#   Range left open because FHIR allows Condition or Observation; the importer
#   materializes clinical:Condition.
# - Added clinical:linkedCondition ObjectProperty (Condition to Condition) and
#   deprecated clinical:linkedConditionIds (owl:deprecated true). The old
#   property packed related-condition UUIDs into one space-separated literal
#   that no graph query can traverse; linkedCondition is the real RDF edge.
#   linkedConditionIds is retained (not removed) for backward compatibility
#   with existing Checkup data; data migration off it is tracked in the Checkup
#   backlog.
# - Fixed clinical:hasLabResult rdfs:range: was clinical:LabResult, now
#   health:LabResultRecord. Reasoning: both importer paths (FHIR and C-CDA) type
#   panel members health:LabResultRecord, never clinical:LabResult, so the
#   declared range described a class the data never uses. This was internally
#   inconsistent (an OWL reasoner would have inferred members are
#   clinical:LabResult) though non-breaking (no SHACL shape constrains the edge
#   target). Corrected to match the serialized data. Note: health:LabResultRecord
#   is emitted by the importer but not yet defined as a class in the health
#   vocabulary; that gap is filed as a follow-up (health vocab), and the
#   range here follows the same reference-an-external-class style this file
#   already uses for fhir:/sct:/loinc: classes.
#
# Version 1.9 (2026-06-17)
# - SHACL: added cascade:AIExtracted to every dataProvenance sh:in enum in
#   clinical.shapes.ttl. AIExtracted (ClinicalGenerated subclass, core v3.3)
#   was defined and referenced by the v3.0 AI-extraction infrastructure
#   (AIExtractionActivity, extractionConfidence, sourceNarrativeSection,
#   requiresUserReview) but the validation enums omitted it, so a clinical
#   record carrying the correct provenance for AI-extracted data failed
#   validation. No ontology classes/properties changed (shapes-only).
#
# Version 1.8 (2026-03-28)
# - Added clinical:SocialHistoryRecord class (EHR-extracted social history)
#   - Subclass of cascade:HealthRecord (new abstract base in core v3.0)
#   - Distinct from health:SocialHistoryRecord (consumer-reported)
#   - Separate pod path: social-history/; consent scope: cascade:SocialHistoryConsent
#   - Subject to 42 CFR Part 2 for substance use disorder records
#   - Reuses health:smokingStatus, health:alcoholUse from health: namespace
#   - Adds clinical-specific: socialHistoryCategory, packsPerYear,
#     alcoholDrinksPerWeek, occupationTitle
#
# Version 1.7 (2026-03-12)
# - Added clinical:Encounter class and properties for FHIR Encounter conversion
# - Added clinical:MedicationAdministration class and properties for
#   FHIR MedicationAdministration conversion
# - Added clinical:DeviceRecord class and properties for FHIR Device conversion
# - Added clinical:ImagingStudy class and properties for FHIR ImagingStudy conversion
# - Added clinical:hasLabResult, clinical:panelName, clinical:reportCategory
#   on clinical:LaboratoryReport for DiagnosticReport panel grouping
#
# Version 1.6 (2026-02-22)
# - Added clinical:linkedConditionIds DatatypeProperty on clinical:Condition
#   for linking related ConditionSummary records via space-separated UUIDs.
#   Enables graph traversal between related diagnoses (e.g., complication to
#   root condition). Part of Health Map v3 Pre-Phase Track A (Task A2).
# - Annotated clinical:vaccineCode as legacy in favor of clinical:cvxCode
#   (both defined; cvxCode added v1.1, vaccineCode retained for backward
#   compatibility).
#
# Version 1.5 (2026-02-10)
# - Added CoverageRecord class (11 properties) for insurance coverage data
#   Maps to fhir:Coverage. Layer 2 complement to checkup:InsuranceInfo (Layer 3).
#   Properties: providerName, memberId, groupNumber, planName, planType,
#   coverageType, relationship, effectivePeriodStart, effectivePeriodEnd,
#   payorName, subscriberId
# - Added 3 new Procedure properties: procedureStatus, procedureCategory,
#   procedureSnomedCode
# - Added administrationRoute property for Medication
#
# Version 1.4 (2026-01-28)
# - Added 5 new lab result properties: orderingProvider, performingLab,
#   observationStatus, sourceRecordId, panelMembership
# - Added LabTestSeries class for longitudinal lab result tracking
#   - 20 properties for identity, trending, reference ranges, source linkage
#   - Lab equivalent of MedicationUseEpisode
# - Extended sourceEHR and provenanceClass domains to include LabResult
# - Extended derivedFromRecord range to include LabResult
#
# Version 1.3 (2026-01-26)
# - Added 14 medication enrichment properties from FHIR pipeline:
#   - Tier 1: prescriber, indication, courseOfTherapyType, asNeeded,
#     medicationForm, activeIngredient, ingredientStrength,
#     provenanceClass, sourceFhirResourceType, clinicalIntent
#   - Tier 2: refillsAllowed, supplyDurationDays, dispensedQuantity,
#     prescriptionCategory
# - Full FHIR extraction pipeline: JSON → MedicationSummary → MedicationRecord → TTL
# - All new fields serialized to TTL via ClinicalRDFSerializer
# - SHACL shapes added with enumerated value constraints
#
# Version 1.2 (2026-01-15)
# - Added MedicationUseEpisode class for longitudinal medication tracking
#   - Represents continuous periods of medication use
#   - Links to source MedicationRecord(s) via derivedFromRecord
#   - Includes inferred status with explainable confidence/reason
#   - Supports multi-system drug coding (RxNorm, NDC, SNOMED, ATC)
# - Added Supplement class for dietary supplements and OTC products
#   - Explicit regulatoryStatus (dietarySupplement, otcDrug, homeopathic, herbalRemedy)
#   - evidenceStrength property for clinical evidence level
#   - DSLD integration for NIH supplement database
# - Added ~25 new data properties for episode and supplement serialization
# - Episode identity rules: gap > 90 days creates new episode
# - Supplements intentionally do NOT create episodes (different regulatory status)
#
# Version 1.1 (2026-01-01)
# - Added 7 structured clinical record classes: Medication, Allergy, LabResult,
#   Condition, Immunization, Procedure, VitalSign
# - Added ~50 data properties for structured records
# - Added vital sign component properties for multi-value observations (BP)
# - Added SHACL shapes for all structured record types
# - Validated with OWL-RL reasoner (no inconsistencies)
# - Validated with Apache Jena SHACL validator
#
# Version 1.0 (2025-12-26)
# - Initial release with document-centric vocabulary
# - ClinicalDocument and subtypes (ProgressNote, DischargeSummary, etc.)
# - ClinicalSection for document structure
# - Document metadata properties (importedAt, sourceEHR, etc.)
# - Narrative content properties
#

# ============================================================================
# Notes
# ============================================================================

# Data Classification: Clinical-generated (EHR-verified)
# All documents imported via clinical: vocabulary use cascade:ClinicalGenerated provenance
# Source: Apple HealthKit HKClinicalRecord API
# Privacy: Documents may contain PHI - encrypted storage required

# ============================================================================
# New Class: clinical:Encounter
# Added in v1.7 — supports FHIR Encounter conversion
# ============================================================================

clinical:Encounter a owl:Class ;
    rdfs:label "Clinical Encounter"@en ;
    rdfs:comment "A clinical encounter — any interaction between a patient and a healthcare provider. Enables grouping of clinical events (procedures, observations, prescriptions) that occurred in the same visit context."@en ;
    rdfs:subClassOf prov:Entity .

clinical:encounterClass a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:string ;
    rdfs:label "Encounter Class"@en ;
    rdfs:comment "Values: ambulatory, emergency, inpatient, home-health"@en .

clinical:encounterStatus a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:string ;
    rdfs:label "Encounter Status"@en ;
    rdfs:comment "Values: finished, in-progress, cancelled"@en .

clinical:encounterType a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:string ;
    rdfs:label "Encounter Type"@en ;
    rdfs:comment "Display name from SNOMED/FHIR code"@en .

clinical:encounterStart a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Encounter Start"@en .

clinical:encounterEnd a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Encounter End"@en .

clinical:facilityName a owl:DatatypeProperty ;
    rdfs:domain clinical:Encounter ;
    rdfs:range xsd:string ;
    rdfs:label "Facility Name"@en .

# ============================================================================
# New Class: clinical:MedicationAdministration
# Added in v1.7 — supports FHIR MedicationAdministration conversion
# ============================================================================

clinical:MedicationAdministration a owl:Class ;
    rdfs:label "Medication Administration"@en ;
    rdfs:comment "A single administration event of a medication given at a specific time by a provider (e.g., IV antibiotics administered pre-surgery, vaccine injection at visit). Semantically distinct from clinical:Medication (ongoing prescription regimens): represents a one-time event, not an ongoing regimen."@en ;
    rdfs:subClassOf prov:Entity .

clinical:administeredDate a owl:DatatypeProperty ;
    rdfs:domain clinical:MedicationAdministration ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Administered Date"@en .

clinical:administeredDose a owl:DatatypeProperty ;
    rdfs:domain clinical:MedicationAdministration ;
    rdfs:range xsd:string ;
    rdfs:label "Administered Dose"@en ;
    rdfs:comment "e.g., '1g', '500mg'"@en .

clinical:administeredRoute a owl:DatatypeProperty ;
    rdfs:domain clinical:MedicationAdministration ;
    rdfs:range xsd:string ;
    rdfs:label "Administered Route"@en ;
    rdfs:comment "Values: oral, IV, IM, subcutaneous, topical"@en .

clinical:administrationStatus a owl:DatatypeProperty ;
    rdfs:domain clinical:MedicationAdministration ;
    rdfs:range xsd:string ;
    rdfs:label "Administration Status"@en ;
    rdfs:comment "Values: completed, not-done, in-progress"@en .

# ============================================================================
# New Class: clinical:ImplantedDevice
# Added in v1.7 — supports FHIR Device conversion
# ============================================================================

clinical:ImplantedDevice a owl:Class ;
    rdfs:label "Implanted Device"@en ;
    rdfs:comment "A medical device implanted in or attached to the patient as a permanent part of their health profile (e.g., pacemaker, cardiac stent, cochlear implant, insulin pump). Presence affects medication safety, imaging eligibility (MRI contraindications), and surgical risk."@en ;
    rdfs:subClassOf prov:Entity .

clinical:deviceType a owl:DatatypeProperty ;
    rdfs:domain clinical:ImplantedDevice ;
    rdfs:range xsd:string ;
    rdfs:label "Device Type"@en ;
    rdfs:comment "e.g., pacemaker, stent, cochlear-implant"@en .

clinical:implantDate a owl:DatatypeProperty ;
    rdfs:domain clinical:ImplantedDevice ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Implant Date"@en .

clinical:deviceManufacturer a owl:DatatypeProperty ;
    rdfs:domain clinical:ImplantedDevice ;
    rdfs:range xsd:string ;
    rdfs:label "Device Manufacturer"@en .

clinical:udiCarrier a owl:DatatypeProperty ;
    rdfs:domain clinical:ImplantedDevice ;
    rdfs:range xsd:string ;
    rdfs:label "UDI Carrier"@en ;
    rdfs:comment "Unique Device Identifier"@en .

clinical:deviceStatus a owl:DatatypeProperty ;
    rdfs:domain clinical:ImplantedDevice ;
    rdfs:range xsd:string ;
    rdfs:label "Device Status"@en ;
    rdfs:comment "Values: active, inactive, entered-in-error"@en .

# ============================================================================
# New Class: clinical:ImagingStudy
# Added in v1.7 — supports FHIR ImagingStudy conversion
# ============================================================================

clinical:ImagingStudy a owl:Class ;
    rdfs:label "Imaging Study"@en ;
    rdfs:comment "Metadata record for a diagnostic imaging study (CT, MRI, X-ray, ultrasound). Records that imaging exists and its key characteristics without requiring access to DICOM images. Useful for clinical timeline, pre-procedure review, and agent reasoning about the patient's imaging history."@en ;
    rdfs:subClassOf prov:Entity .

clinical:imagingModality a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:string ;
    rdfs:label "Imaging Modality"@en ;
    rdfs:comment "Values: CT, MR, DX, US, NM"@en .

clinical:studyDescription a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:string ;
    rdfs:label "Study Description"@en .

clinical:numberOfSeries a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:integer ;
    rdfs:label "Number of Series"@en .

clinical:studyDate a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Study Date"@en .

clinical:dicomStudyUid a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:string ;
    rdfs:label "DICOM Study UID"@en .

clinical:retrieveUrl a owl:DatatypeProperty ;
    rdfs:domain clinical:ImagingStudy ;
    rdfs:range xsd:anyURI ;
    rdfs:label "Retrieve URL"@en ;
    rdfs:comment "URL to DICOM server if available"@en .

# ============================================================================
# New Properties on existing class: clinical:LaboratoryReport
# Added in v1.7 — supports DiagnosticReport panel grouping
# ============================================================================

clinical:hasLabResult a owl:ObjectProperty ;
    rdfs:label "Has Lab Result"@en ;
    rdfs:comment "Links a LaboratoryReport panel to its constituent lab-result observations. Enables grouping of lab values (e.g., CBC components) under the ordering panel. FHIR alignment: fhir:DiagnosticReport.result. Range is health:LabResultRecord (v1.10): both importer paths (FHIR and C-CDA) type panel members health:LabResultRecord, so the range is corrected to match the serialized data rather than the never-emitted clinical:LabResult class. See the v1.10 changelog for the reasoning."@en ;
    rdfs:domain clinical:LaboratoryReport ;
    rdfs:range health:LabResultRecord .

clinical:panelName a owl:DatatypeProperty ;
    rdfs:domain clinical:LaboratoryReport ;
    rdfs:range xsd:string ;
    rdfs:label "Panel Name"@en ;
    rdfs:comment "e.g., 'Complete Blood Count'"@en .

clinical:reportCategory a owl:DatatypeProperty ;
    rdfs:domain clinical:LaboratoryReport ;
    rdfs:range xsd:string ;
    rdfs:label "Report Category"@en ;
    rdfs:comment "Values: LAB, RAD, PATH"@en .

# ============================================================================
# Social History Classes and Properties (v1.8)
# ============================================================================
# Social History (v1.8) — EHR-extracted social history with 42 CFR Part 2 compliance

clinical:SocialHistoryRecord a owl:Class ;
    rdfs:subClassOf cascade:HealthRecord ;
    rdfs:label "Social History Record"@en ;
    rdfs:comment "An EHR-extracted social or behavioral history observation from a C-CDA Social History section. Distinct from health:SocialHistoryRecord (consumer-reported). Requires separate consent scope (cascade:SocialHistoryConsent) and pod path (social-history/). Subject to 42 CFR Part 2 for substance use records."@en ;
    owl:versionInfo "Added in clinical v1.8" .

clinical:socialHistoryCategory a owl:DatatypeProperty ;
    rdfs:domain clinical:SocialHistoryRecord ;
    rdfs:range xsd:string ;
    rdfs:comment "Category of social history observation. Values: smokingStatus | alcoholUse | substanceUse | occupation | exercise | diet | sexualHistory | other"@en .

# NOTE: health:smokingStatus and health:alcoholUse are REUSED from health: namespace (no domain restriction).
# clinical: adds only properties with no equivalent in health: namespace:

clinical:packsPerYear a owl:DatatypeProperty ;
    rdfs:domain clinical:SocialHistoryRecord ;
    rdfs:range xsd:decimal ;
    rdfs:comment "Pack-years of tobacco use (packs/day x years smoked). EHR-specific quantitative field."@en .

clinical:alcoholDrinksPerWeek a owl:DatatypeProperty ;
    rdfs:domain clinical:SocialHistoryRecord ;
    rdfs:range xsd:decimal ;
    rdfs:comment "Average alcoholic drinks per week (quantitative EHR field)."@en .

clinical:occupationTitle a owl:DatatypeProperty ;
    rdfs:domain clinical:SocialHistoryRecord ;
    rdfs:range xsd:string ;
    rdfs:comment "Patient-reported occupation title from EHR social history section."@en .

# ============================================================================
# Graph Edge Object Properties (v1.10)
# Traversable RDF edges the importer (R3) will materialize: encounter grouping,
# medication indication, and condition-to-condition links. Each is FHIR-aligned.
# ============================================================================

clinical:hasEncounter a owl:ObjectProperty ;
    rdfs:label "Has Encounter"@en ;
    rdfs:comment "Links a clinical record to the clinical:Encounter (visit context) it occurred within. FHIR alignment: the .encounter element (Reference(Encounter)) carried by Observation, MedicationRequest, Condition, Procedure, DiagnosticReport, and DocumentReference. The domain is intentionally broad (any encounter-scoped clinical record), so it is left unrestricted here and constrained by SHACL rather than a restrictive rdfs:domain union, matching the style of other cross-class properties in this vocabulary."@en ;
    rdfs:range clinical:Encounter .

clinical:indicationReference a owl:ObjectProperty ;
    rdfs:label "Indication Reference"@en ;
    rdfs:comment "Links a clinical record to the condition (or observation) that is the clinical reason for it: the traversable edge alongside the free-text clinical:indication and clinical:reasonForUse literals, which are retained. FHIR alignment: the reasonReference element (Reference(Condition|Observation|...)), which FHIR R4 carries on Procedure, MedicationRequest, MedicationAdministration, Encounter, and other event resources (see https://hl7.org/fhir/R4/procedure-definitions.html#Procedure.reasonReference), folded into a .reason CodeableReference in R5. The domain is intentionally broad (any record that carries a clinical reason), so it is left unrestricted here and constrained by SHACL rather than a restrictive rdfs:domain union, matching clinical:hasEncounter and the other cross-class properties in this vocabulary. The range is left open (rdfs:Resource) because FHIR permits either a Condition or an Observation as the reason; the common case, and what the importer materializes, is a clinical:Condition. SHACL constrains the object to an IRI without committing the class."@en ;
    rdfs:range rdfs:Resource .

clinical:linkedCondition a owl:ObjectProperty ;
    rdfs:label "Linked Condition"@en ;
    rdfs:comment "Links a condition to a related condition by IRI (e.g. a complication to its root condition). The traversable RDF replacement for the deprecated clinical:linkedConditionIds literal. FHIR R4 core has no first-class condition-to-condition reference; the closest precedents are the condition-dueTo and condition-occurredFollowing extensions (http://hl7.org/fhir/StructureDefinition/condition-dueTo). This property keeps the generic linked semantics of its predecessor; a more specific relation can be added later if a use case needs it."@en ;
    rdfs:domain clinical:Condition ;
    rdfs:range clinical:Condition .

clinical:parsedIndicationReference a owl:ObjectProperty ;
    rdfs:label "Parsed Indication Reference"@en ;
    rdfs:comment "An indication edge the importer DERIVED by parsing a coded or free-text reason the record carries (FHIR reasonCode, or a clinical:indication / clinical:reasonForUse literal) and matching it to a condition record in the same pod. It is a subproperty of clinical:indicationReference, so one traversal over the superproperty returns both stated and parsed indications, while the predicate itself remains the machine-readable basis: clinical:indicationReference proper restates an explicit reference the SOURCE carried (FHIR reasonReference), whereas this property records a match the importer computed. Consumers must present the two differently (e.g. 'Indication' vs 'Indication (from record text)') because a parsed match is only as good as the code or wording it matched on. Matching is code-first (exact coding-system + code identity against the condition's own code) with a normalized-name fallback, and an edge is written only when exactly one candidate matches; ambiguous and unmatched reasons are counted in the import report, never guessed. This property carries no confidence score: it is a deterministic parse of what the record already says, NOT an inference from structure, timing, or co-occurrence, which remain out of scope for the importer and are computed at query time instead."@en ;
    rdfs:subPropertyOf clinical:indicationReference ;
    rdfs:range rdfs:Resource .
