R6 Ballot (2nd Draft)

Publish-box (todo)

Explanationofbenefit.shex

Financial Management Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Device, Encounter, Patient, Practitioner, RelatedPerson

Raw ShEx

ShEx statement for explanationofbenefit

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <code.shex>
IMPORT <date.shex>
IMPORT <Claim.shex>
IMPORT <Money.shex>
IMPORT <Period.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <Device.shex>
IMPORT <Patient.shex>
IMPORT <boolean.shex>
IMPORT <decimal.shex>
IMPORT <Address.shex>
IMPORT <dateTime.shex>
IMPORT <Location.shex>
IMPORT <Quantity.shex>
IMPORT <Resource.shex>
IMPORT <Coverage.shex>
IMPORT <Reference.shex>
IMPORT <Condition.shex>
IMPORT <Procedure.shex>
IMPORT <Encounter.shex>
IMPORT <Identifier.shex>
IMPORT <Attachment.shex>
IMPORT <positiveInt.shex>
IMPORT <unsignedInt.shex>
IMPORT <Practitioner.shex>
IMPORT <Organization.shex>
IMPORT <RelatedPerson.shex>
IMPORT <ClaimResponse.shex>
IMPORT <DeviceRequest.shex>
IMPORT <SupplyRequest.shex>
IMPORT <DomainResource.shex>
IMPORT <ServiceRequest.shex>
IMPORT <NutritionOrder.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <PractitionerRole.shex>
IMPORT <MedicationRequest.shex>
IMPORT <CodeableReference.shex>
IMPORT <VisionPrescription.shex>


start=@<ExplanationOfBenefit> AND {fhir:nodeRole [fhir:treeRoot]}

# Explanation of Benefit resource
<ExplanationOfBenefit> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:ExplanationOfBenefit]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<OneOrMore_Identifier>?;  # Business Identifier for the 
                                            # resource 
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:status @<code> AND
    	{fhir:v @fhirvs:explanationofbenefit-status};  # active | cancelled | draft | 
                                            # entered-in-error 
    fhir:type @<CodeableConcept>;           # Category or discipline
    fhir:subType @<CodeableConcept>?;       # More granular claim type
    fhir:use @<code> AND
    	{fhir:v @fhirvs:claim-use};  # claim | preauthorization | 
                                            # predetermination 
    fhir:patient @<Reference> AND {fhir:link 
    			@<Patient> ? };  # The recipient of the products and 
                                            # services 
    fhir:billablePeriod @<Period>?;         # Relevant time frame for the claim
    fhir:created @<dateTime>;               # Response creation date
    fhir:enterer @<Reference> AND {fhir:link 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # Author of the claim
    fhir:insurer @<Reference> AND {fhir:link 
    			@<Organization> ? }?;  # Party responsible for reimbursement
    fhir:provider @<Reference> AND {fhir:link 
    			@<Organization> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> ? }?;  # Party responsible for the claim
    fhir:priority @<CodeableConcept>?;      # Desired processing urgency
    fhir:fundsReserveRequested @<CodeableConcept>?;  # For whom to reserve funds
    fhir:fundsReserve @<CodeableConcept>?;  # Funds reserved status
    fhir:related @<OneOrMore_ExplanationOfBenefit.related>?;  # Prior or corollary claims
    fhir:prescription @<Reference> AND {fhir:link 
    			@<MedicationRequest> OR 
    			@<VisionPrescription> ? }?;  # Prescription authorizing services 
                                            # or products 
    fhir:originalPrescription @<Reference> AND {fhir:link 
    			@<MedicationRequest> ? }?;  # Original prescription if 
                                            # superceded by fulfiller 
    fhir:event @<OneOrMore_ExplanationOfBenefit.event>?;  # Event information
    fhir:payee @<ExplanationOfBenefit.payee>?;  # Recipient of benefits payable
    fhir:referral @<Reference> AND {fhir:link 
    			@<ServiceRequest> ? }?;  # Treatment Referral
    fhir:encounter @<OneOrMore_Reference_Encounter>?;  # Encounters associated with the 
                                            # listed treatments 
    fhir:facility @<Reference> AND {fhir:link 
    			@<Location> OR 
    			@<Organization> ? }?;  # Servicing Facility
    fhir:claim @<Reference> AND {fhir:link 
    			@<Claim> ? }?;  # Claim reference
    fhir:claimResponse @<Reference> AND {fhir:link 
    			@<ClaimResponse> ? }?;  # Claim response reference
    fhir:outcome @<code> AND
    	{fhir:v @fhirvs:claim-outcome};  # queued | complete | error | partial
    fhir:decision @<CodeableConcept>?;      # Result of the adjudication
    fhir:disposition @<string>?;            # Disposition Message
    fhir:preAuthRef @<OneOrMore_string>?;   # Preauthorization reference
    fhir:preAuthRefPeriod @<OneOrMore_Period>?;  # Preauthorization in-effect period
    fhir:diagnosisRelatedGroup @<CodeableConcept>?;  # Package billing code
    fhir:careTeam @<OneOrMore_ExplanationOfBenefit.careTeam>?;  # Care Team members
    fhir:supportingInfo @<OneOrMore_ExplanationOfBenefit.supportingInfo>?;  # Supporting information
    fhir:diagnosis @<OneOrMore_ExplanationOfBenefit.diagnosis>?;  # Pertinent diagnosis information
    fhir:procedure @<OneOrMore_ExplanationOfBenefit.procedure>?;  # Clinical procedures performed
    fhir:precedence @<positiveInt>?;        # Precedence (primary, secondary, 
                                            # etc.) 
    fhir:insurance @<OneOrMore_ExplanationOfBenefit.insurance>?;  # Patient insurance information
    fhir:accident @<ExplanationOfBenefit.accident>?;  # Details of the event
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:item @<OneOrMore_ExplanationOfBenefit.item>?;  # Product or service provided
    fhir:addItem @<OneOrMore_ExplanationOfBenefit.addItem>?;  # Insurer added line items
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Header-level adjudication
    fhir:total @<OneOrMore_ExplanationOfBenefit.total>?;  # Adjudication totals
    fhir:payment @<ExplanationOfBenefit.payment>?;  # Payment Details
    fhir:formCode @<CodeableConcept>?;      # Printed form identifier
    fhir:form @<Attachment>?;               # Printed reference or actual form
    fhir:processNote @<OneOrMore_ExplanationOfBenefit.processNote>?;  # Note concerning adjudication
    fhir:benefitPeriod @<Period>?;          # When the benefits are applicable
    fhir:benefitBalance @<OneOrMore_ExplanationOfBenefit.benefitBalance>?;  # Balance by Benefit Category
}  

# Adjudication totals
<ExplanationOfBenefit.total> EXTENDS @<BackboneElement> CLOSED {   
    fhir:category @<CodeableConcept>;       # Type of adjudication information
    fhir:amount @<Money>;                   # Financial total for the category
}  

# Balance by Benefit Category
<ExplanationOfBenefit.benefitBalance> EXTENDS @<BackboneElement> CLOSED {   
    fhir:category @<CodeableConcept>;       # Benefit classification
    fhir:excluded @<boolean>?;              # Excluded from the plan
    fhir:name @<string>?;                   # Short name for the benefit
    fhir:description @<string>?;            # Description of the benefit or 
                                            # services covered 
    fhir:network @<CodeableConcept>?;       # In or out of network
    fhir:unit @<CodeableConcept>?;          # Individual or family
    fhir:term @<CodeableConcept>?;          # Annual or lifetime
    fhir:financial @<OneOrMore_ExplanationOfBenefit.benefitBalance.financial>?;  # Benefit Summary
}  

# Anatomical location
<ExplanationOfBenefit.addItem.bodySite> EXTENDS @<BackboneElement> CLOSED {   
    fhir:site @<OneOrMore_CodeableReference>;  # Location
    fhir:subSite @<OneOrMore_CodeableConcept>?;  # Sub-location
}  

# Benefit Summary
<ExplanationOfBenefit.benefitBalance.financial> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>;           # Benefit classification
    fhir:allowed @<unsignedInt>  OR 
    			@<string>  OR 
    			@<Money>  ?;  # Benefits allowed
    fhir:used @<unsignedInt>  OR 
    			@<Money>  ?;  # Benefits used
}  

# Supporting information
<ExplanationOfBenefit.supportingInfo> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Information instance identifier
    fhir:category @<CodeableConcept>;       # Classification of the supplied 
                                            # information 
    fhir:code @<CodeableConcept>?;          # Type of information
    fhir:timing @<date>  OR 
    			@<Period>  ?;  # When it occurred
    fhir:value @<boolean>  OR 
    			@<string>  OR 
    			@<Quantity>  OR 
    			@<Attachment>  OR 
    			(@<Reference>  AND {fhir:link @<Resource> })  OR 
    			@<Identifier>  ?;  # Data to be provided
    fhir:reason @<Coding>?;                 # Explanation for the information
}  

# Insurer added line items
<ExplanationOfBenefit.addItem.detail.subDetail> EXTENDS @<BackboneElement> CLOSED {   
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Service/Product billing modifiers
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Additem subdetail level 
                                            # adjudication results 
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Added items adjudication
}  

# Pertinent diagnosis information
<ExplanationOfBenefit.diagnosis> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Diagnosis instance identifier
    fhir:diagnosis @<CodeableConcept>  OR 
    			(@<Reference>  AND {fhir:link @<Condition> })  ;  # Nature of illness or problem
    fhir:type @<OneOrMore_CodeableConcept>?;  # Timing or nature of the diagnosis
    fhir:onAdmission @<CodeableConcept>?;   # Present on admission
}  

# Additional items
<ExplanationOfBenefit.item.detail> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Product or service provided
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:category @<CodeableConcept>?;      # Benefit classification
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Service/Product billing modifiers
    fhir:programCode @<OneOrMore_CodeableConcept>?;  # Program the product or service is 
                                            # provided under 
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:udi @<OneOrMore_Reference_Device>?;  # Unique device identifier
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Detail level adjudication results
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Detail level adjudication details
    fhir:subDetail @<OneOrMore_ExplanationOfBenefit.item.detail.subDetail>?;  # Additional items
}  

# Insurer added line items
<ExplanationOfBenefit.addItem> EXTENDS @<BackboneElement> CLOSED {   
    fhir:itemSequence @<OneOrMore_positiveInt>?;  # Item sequence number
    fhir:detailSequence @<OneOrMore_positiveInt>?;  # Detail sequence number
    fhir:subDetailSequence @<OneOrMore_positiveInt>?;  # Subdetail sequence number
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:provider @<OneOrMore_Reference_Organization_OR_Practitioner_OR_PractitionerRole>?;  # Authorized providers
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:request @<OneOrMore_Reference_DeviceRequest_OR_MedicationRequest_OR_NutritionOrder_OR_ServiceRequest_OR_SupplyRequest_OR_VisionPrescription>?;  # Request or Referral for Service
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Service/Product billing modifiers
    fhir:programCode @<OneOrMore_CodeableConcept>?;  # Program the product or service is 
                                            # provided under 
    fhir:serviced @<date>  OR 
    			@<Period>  ?;  # Date or dates of service or 
                                            # product delivery 
    fhir:location @<CodeableConcept>  OR 
    			@<Address>  OR 
    			(@<Reference>  AND {fhir:link @<Location> })  ?;  # Place of service or where product 
                                            # was supplied 
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:bodySite @<OneOrMore_ExplanationOfBenefit.addItem.bodySite>?;  # Anatomical location
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Additem level adjudication results
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Added items adjudication
    fhir:detail @<OneOrMore_ExplanationOfBenefit.addItem.detail>?;  # Insurer added line items
}  

# Patient insurance information
<ExplanationOfBenefit.insurance> EXTENDS @<BackboneElement> CLOSED {   
    fhir:focal @<boolean>;                  # Coverage to be used for 
                                            # adjudication 
    fhir:coverage @<Reference> AND {fhir:link 
    			@<Coverage> ? };  # Insurance information
    fhir:preAuthRef @<OneOrMore_string>?;   # Prior authorization reference 
                                            # number 
}  

# Note concerning adjudication
<ExplanationOfBenefit.processNote> EXTENDS @<BackboneElement> CLOSED {   
    fhir:number @<positiveInt>?;            # Note instance identifier
    fhir:type @<CodeableConcept>?;          # Note purpose
    fhir:text @<string>?;                   # Note explanatory text
    fhir:language @<CodeableConcept>?;      # Language of the text
}  

# Recipient of benefits payable
<ExplanationOfBenefit.payee> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # Category of recipient
    fhir:party @<Reference> AND {fhir:link 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # Recipient reference
}  

# Adjudication details
<ExplanationOfBenefit.item.adjudication> EXTENDS @<BackboneElement> CLOSED {   
    fhir:category @<CodeableConcept>;       # Type of adjudication information
    fhir:reason @<CodeableConcept>?;        # Explanation of adjudication outcome
    fhir:amount @<Money>?;                  # Monetary amount
    fhir:quantity @<Quantity>?;             # Non-monitary value
}  

# Details of the event
<ExplanationOfBenefit.accident> EXTENDS @<BackboneElement> CLOSED {   
    fhir:date @<date>?;                     # When the incident occurred
    fhir:type @<CodeableConcept>?;          # The nature of the accident
    fhir:location @<Address>  OR 
    			(@<Reference>  AND {fhir:link @<Location> })  ?;  # Where the event occurred
}  

# Anatomical location
<ExplanationOfBenefit.item.bodySite> EXTENDS @<BackboneElement> CLOSED {   
    fhir:site @<OneOrMore_CodeableReference>;  # Location
    fhir:subSite @<OneOrMore_CodeableConcept>?;  # Sub-location
}  

# Product or service provided
<ExplanationOfBenefit.item> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Item instance identifier
    fhir:careTeamSequence @<OneOrMore_positiveInt>?;  # Applicable care team members
    fhir:diagnosisSequence @<OneOrMore_positiveInt>?;  # Applicable diagnoses
    fhir:procedureSequence @<OneOrMore_positiveInt>?;  # Applicable procedures
    fhir:informationSequence @<OneOrMore_positiveInt>?;  # Applicable exception and 
                                            # supporting information 
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:category @<CodeableConcept>?;      # Benefit classification
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:request @<OneOrMore_Reference_DeviceRequest_OR_MedicationRequest_OR_NutritionOrder_OR_ServiceRequest_OR_SupplyRequest_OR_VisionPrescription>?;  # Request or Referral for Service
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Product or service billing 
                                            # modifiers 
    fhir:programCode @<OneOrMore_CodeableConcept>?;  # Program the product or service is 
                                            # provided under 
    fhir:serviced @<date>  OR 
    			@<Period>  ?;  # Date or dates of service or 
                                            # product delivery 
    fhir:location @<CodeableConcept>  OR 
    			@<Address>  OR 
    			(@<Reference>  AND {fhir:link @<Location> })  ?;  # Place of service or where product 
                                            # was supplied 
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:udi @<OneOrMore_Reference_Device>?;  # Unique device identifier
    fhir:bodySite @<OneOrMore_ExplanationOfBenefit.item.bodySite>?;  # Anatomical location
    fhir:encounter @<OneOrMore_Reference_Encounter>?;  # Encounters associated with the 
                                            # listed treatments 
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Adjudication results
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Adjudication details
    fhir:detail @<OneOrMore_ExplanationOfBenefit.item.detail>?;  # Additional items
}  

# Insurer added line items
<ExplanationOfBenefit.addItem.detail> EXTENDS @<BackboneElement> CLOSED {   
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Service/Product billing modifiers
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Additem detail level adjudication 
                                            # results 
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Added items adjudication
    fhir:subDetail @<OneOrMore_ExplanationOfBenefit.addItem.detail.subDetail>?;  # Insurer added line items
}  

# Clinical procedures performed
<ExplanationOfBenefit.procedure> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Procedure instance identifier
    fhir:type @<OneOrMore_CodeableConcept>?;  # Category of Procedure
    fhir:date @<dateTime>?;                 # When the procedure was performed
    fhir:procedure @<CodeableConcept>  OR 
    			(@<Reference>  AND {fhir:link @<Procedure> })  ;  # Specific clinical procedure
    fhir:udi @<OneOrMore_Reference_Device>?;  # Unique device identifier
}  

# Care Team members
<ExplanationOfBenefit.careTeam> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Order of care team
    fhir:provider @<Reference> AND {fhir:link 
    			@<Organization> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> ? };  # Practitioner or organization
    fhir:responsible @<boolean>?;           # Indicator of the lead practitioner
    fhir:role @<CodeableConcept>?;          # Function within the team
    fhir:specialty @<CodeableConcept>?;     # Practitioner or provider 
                                            # specialization 
}  

# Event information
<ExplanationOfBenefit.event> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>;           # Specific event
    fhir:when @<dateTime>  OR 
    			@<Period>  ;  # Occurance date or period
}  

# Prior or corollary claims
<ExplanationOfBenefit.related> EXTENDS @<BackboneElement> CLOSED {   
    fhir:claim @<Reference> AND {fhir:link 
    			@<Claim> ? }?;  # Reference to the related claim
    fhir:relationship @<CodeableConcept>?;  # How the reference claim is related
    fhir:reference @<Identifier>?;          # File or case reference
}  

# Adjudication results
<ExplanationOfBenefit.item.reviewOutcome> EXTENDS @<BackboneElement> CLOSED {   
    fhir:decision @<CodeableConcept>?;      # Result of the adjudication
    fhir:reason @<OneOrMore_CodeableConcept>?;  # Reason for result of the 
                                            # adjudication 
    fhir:preAuthRef @<string>?;             # Preauthorization reference
    fhir:preAuthPeriod @<Period>?;          # Preauthorization reference 
                                            # effective period 
}  

# Additional items
<ExplanationOfBenefit.item.detail.subDetail> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<positiveInt>;           # Product or service provided
    fhir:traceNumber @<OneOrMore_Identifier>?;  # Number for tracking
    fhir:revenue @<CodeableConcept>?;       # Revenue or cost center code
    fhir:category @<CodeableConcept>?;      # Benefit classification
    fhir:productOrService @<CodeableConcept>?;  # Billing, service, product, or drug 
                                            # code 
    fhir:productOrServiceEnd @<CodeableConcept>?;  # End of a range of codes
    fhir:modifier @<OneOrMore_CodeableConcept>?;  # Service/Product billing modifiers
    fhir:programCode @<OneOrMore_CodeableConcept>?;  # Program the product or service is 
                                            # provided under 
    fhir:patientPaid @<Money>?;             # Paid by the patient
    fhir:quantity @<Quantity>?;             # Count of products or services
    fhir:unitPrice @<Money>?;               # Fee, charge or cost per item
    fhir:factor @<decimal>?;                # Price scaling factor
    fhir:tax @<Money>?;                     # Total tax
    fhir:net @<Money>?;                     # Total item cost
    fhir:udi @<OneOrMore_Reference_Device>?;  # Unique device identifier
    fhir:noteNumber @<OneOrMore_positiveInt>?;  # Applicable note numbers
    fhir:reviewOutcome @<ExplanationOfBenefit.item.reviewOutcome>?;  # Subdetail level adjudication 
                                            # results 
    fhir:adjudication @<OneOrMore_ExplanationOfBenefit.item.adjudication>?;  # Subdetail level adjudication 
                                            # details 
}  

# Payment Details
<ExplanationOfBenefit.payment> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # Partial or complete payment
    fhir:adjustment @<Money>?;              # Payment adjustment for non-claim 
                                            # issues 
    fhir:adjustmentReason @<CodeableConcept>?;  # Explanation for the variance
    fhir:date @<date>?;                     # Expected date of payment
    fhir:amount @<Money>?;                  # Payable amount after adjustment
    fhir:identifier @<Identifier>?;         # Business identifier for the payment
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_ExplanationOfBenefit.related> CLOSED {
    rdf:first @<ExplanationOfBenefit.related>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.related> 
}

<OneOrMore_ExplanationOfBenefit.event> CLOSED {
    rdf:first @<ExplanationOfBenefit.event>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.event> 
}

<OneOrMore_Reference_Encounter> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Encounter> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Encounter> 
}

<OneOrMore_string> CLOSED {
    rdf:first @<string>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_string> 
}

<OneOrMore_Period> CLOSED {
    rdf:first @<Period>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Period> 
}

<OneOrMore_ExplanationOfBenefit.careTeam> CLOSED {
    rdf:first @<ExplanationOfBenefit.careTeam>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.careTeam> 
}

<OneOrMore_ExplanationOfBenefit.supportingInfo> CLOSED {
    rdf:first @<ExplanationOfBenefit.supportingInfo>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.supportingInfo> 
}

<OneOrMore_ExplanationOfBenefit.diagnosis> CLOSED {
    rdf:first @<ExplanationOfBenefit.diagnosis>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.diagnosis> 
}

<OneOrMore_ExplanationOfBenefit.procedure> CLOSED {
    rdf:first @<ExplanationOfBenefit.procedure>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.procedure> 
}

<OneOrMore_ExplanationOfBenefit.insurance> CLOSED {
    rdf:first @<ExplanationOfBenefit.insurance>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.insurance> 
}

<OneOrMore_ExplanationOfBenefit.item> CLOSED {
    rdf:first @<ExplanationOfBenefit.item>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.item> 
}

<OneOrMore_ExplanationOfBenefit.addItem> CLOSED {
    rdf:first @<ExplanationOfBenefit.addItem>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.addItem> 
}

<OneOrMore_ExplanationOfBenefit.item.adjudication> CLOSED {
    rdf:first @<ExplanationOfBenefit.item.adjudication>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.item.adjudication> 
}

<OneOrMore_ExplanationOfBenefit.total> CLOSED {
    rdf:first @<ExplanationOfBenefit.total>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.total> 
}

<OneOrMore_ExplanationOfBenefit.processNote> CLOSED {
    rdf:first @<ExplanationOfBenefit.processNote>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.processNote> 
}

<OneOrMore_ExplanationOfBenefit.benefitBalance> CLOSED {
    rdf:first @<ExplanationOfBenefit.benefitBalance>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.benefitBalance> 
}

<OneOrMore_ExplanationOfBenefit.benefitBalance.financial> CLOSED {
    rdf:first @<ExplanationOfBenefit.benefitBalance.financial>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.benefitBalance.financial> 
}

<OneOrMore_CodeableReference> CLOSED {
    rdf:first @<CodeableReference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableReference> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_positiveInt> CLOSED {
    rdf:first @<positiveInt>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_positiveInt> 
}

<OneOrMore_Reference_Device> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Device> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Device> 
}

<OneOrMore_ExplanationOfBenefit.item.detail.subDetail> CLOSED {
    rdf:first @<ExplanationOfBenefit.item.detail.subDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.item.detail.subDetail> 
}

<OneOrMore_Reference_Organization_OR_Practitioner_OR_PractitionerRole> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Organization> OR 
			@<Practitioner> OR 
			@<PractitionerRole> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Organization_OR_Practitioner_OR_PractitionerRole> 
}

<OneOrMore_Reference_DeviceRequest_OR_MedicationRequest_OR_NutritionOrder_OR_ServiceRequest_OR_SupplyRequest_OR_VisionPrescription> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<DeviceRequest> OR 
			@<MedicationRequest> OR 
			@<NutritionOrder> OR 
			@<ServiceRequest> OR 
			@<SupplyRequest> OR 
			@<VisionPrescription> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_DeviceRequest_OR_MedicationRequest_OR_NutritionOrder_OR_ServiceRequest_OR_SupplyRequest_OR_VisionPrescription> 
}

<OneOrMore_ExplanationOfBenefit.addItem.bodySite> CLOSED {
    rdf:first @<ExplanationOfBenefit.addItem.bodySite>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.addItem.bodySite> 
}

<OneOrMore_ExplanationOfBenefit.addItem.detail> CLOSED {
    rdf:first @<ExplanationOfBenefit.addItem.detail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.addItem.detail> 
}

<OneOrMore_ExplanationOfBenefit.item.bodySite> CLOSED {
    rdf:first @<ExplanationOfBenefit.item.bodySite>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.item.bodySite> 
}

<OneOrMore_ExplanationOfBenefit.item.detail> CLOSED {
    rdf:first @<ExplanationOfBenefit.item.detail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.item.detail> 
}

<OneOrMore_ExplanationOfBenefit.addItem.detail.subDetail> CLOSED {
    rdf:first @<ExplanationOfBenefit.addItem.detail.subDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ExplanationOfBenefit.addItem.detail.subDetail> 
}

#---------------------- Value Sets ------------------------

# This value set includes Claim Processing Outcome codes.
fhirvs:claim-outcome ["queued" "complete" "error" "partial"]

# The purpose of the Claim: predetermination, preauthorization, claim.
fhirvs:claim-use ["claim" "preauthorization" "predetermination"]

# A code specifying the state of the resource instance.
fhirvs:explanationofbenefit-status ["active" "cancelled" "draft" "entered-in-error"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.