All FHIR resources contain attributes defined in Resource, and most FHIR resources contain attributes defined in DomainResource. They do this by extending one or the other.
If you come from a software development background, consider Resource to be the base object and DomainResource a derived object that inherits from (extends) the Resource object. In this context, all 140+ FHIR resources inherit from (extend) one of these two data objects.
Resource contains the “id” attribute, as well as the “meta” object which includes the “lastUpdated” attribute.
DomainResource contains attributes such as “text”, “contained”, “extension” and “modifierExtension.”
Of the 140+ resources in FHIR R4, all but three of them extend DomainResource, giving them access to the attributes of both Resource and DomainResource. Only Bundle, Parameters and Binary extend Resource directly, as they do not use the attributes contained in DomainResource.
This can be a tricky concept for non-developers. When working with a resource, pay close attention to the “Description & Constraints” column in the FHIR documentation for the resource name. This tells you exactly which attributes defined in an ancestor are available to that resource.
Sign up to “The Tuesday FHIR Sessions” and receive an email every Tuesday where I go deep on a single FHIR topic.