<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASLocation" />
  <name value="UNICASLocation" />
  <title value="Location Localización y Servicio Asistencial ÚNICAS" />
  <status value="draft" />
  <description value="Este profile define las restricciones del recurso Location para representar la localización y el servicio asistencial en el contexto del caso de uso de ÚNICAS." />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Location" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Location" />
  <derivation value="constraint" />
  <differential>
    <element id="Location.identifier">
      <path value="Location.identifier" />
      <short value="Identificador único" />
      <definition value="Unique code or number identifying the location to its users" />
      <min value="1" />
    </element>
    <element id="Location.identifier.system">
      <path value="Location.identifier.system" />
      <short value="Sistema para identificar el origen" />
      <definition value="Formato: urn:regcess:[CódigoREGCESS] Debe incluir el código REGCESS después de urn:regcess:" />
      <min value="1" />
      <constraint>
        <key value="regcess-system" />
        <severity value="warning" />
        <human value="system debe comenzar por urn:regcess: seguido del identificador del sistema." />
        <expression value="matches('^urn:regcess:[A-Za-z0-9]+$')" />
      </constraint>
    </element>
    <element id="Location.identifier.value">
      <path value="Location.identifier.value" />
      <short value="Identificador interno del sistema para la localización" />
      <definition value="Debe indicar el ID interno del sistema de origen utilizado para la localización." />
      <min value="1" />
    </element>
    <element id="Location.name">
      <path value="Location.name" />
      <short value="Lugar donde se realiza la cita" />
      <min value="1" />
    </element>
    <element id="Location.description">
      <path value="Location.description" />
      <short value="Descripción completa de lugar donde se realiza la cita" />
      <definition value="Additional details about the location that could be displayed as further information to identify the location beyond its name. Description of the Location, which helps in finding or referencing the place." />
    </element>
    <element id="Location.managingOrganization">
      <path value="Location.managingOrganization" />
      <short value="Referencia al servicio asistencial donde se realiza la cita" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASOrganization" />
      </type>
    </element>
    <element id="Location.managingOrganization.reference">
      <path value="Location.managingOrganization.reference" />
      <short value="Referencia recurso FHIR. Identificador de la referencia del recurso FHIR asociado cuando exista/creamos un recurso en el mismo servidor FHIR" />
      <definition value="Formato: [base]/Organization?identifier=[OID registro de número de REGCESS]|[Código REGCESS de la institución]" />
    </element>
    <element id="Location.managingOrganization.type">
      <path value="Location.managingOrganization.type" />
      <short value="Tipo de recurso FHIR" />
      <definition value="Type the reference refers to (e.g. &quot;Patient&quot;) - must be a resource in resources. The expected type of the target of the reference. If both Reference.type and Reference.reference are populated and Reference.reference is a FHIR URL, both SHALL be consistent.&#xA;&#xA;The type is the Canonical URL of Resource Definition that is the type this reference refers to. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition/ e.g. &quot;Patient&quot; is a reference to http://hl7.org/fhir/StructureDefinition/Patient. Absolute URLs are only allowed for logical models (and can only be used in references in logical models, not resources)." />
      <min value="1" />
    </element>
    <element id="Location.managingOrganization.identifier">
      <path value="Location.managingOrganization.identifier" />
      <short value="Identificador del centro de atención primaria. Cuando no tengamos recurso Organization, se debera informar el identificador de institución mediante código REGCESS" />
      <definition value="Logical reference, when literal reference is not known. An identifier for the target resource. This is used when there is no way to reference the other resource directly, either because the entity it represents is not available through a FHIR server, or because there is no way for the author of the resource to convert a known identifier to an actual location. There is no requirement that a Reference.identifier point to something that is actually exposed as a FHIR instance, but it SHALL point to a business concept that would be expected to be exposed as a FHIR instance, and that instance would need to be of a FHIR resource type allowed by the reference." />
      <min value="1" />
    </element>
    <element id="Location.managingOrganization.identifier.system">
      <path value="Location.managingOrganization.identifier.system" />
      <short value="OID registro de número de REGCESS" />
      <definition value="The namespace for the identifier value. Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique." />
    </element>
    <element id="Location.managingOrganization.identifier.value">
      <path value="Location.managingOrganization.identifier.value" />
      <short value="Código REGCESS" />
      <definition value="The value that is unique. The portion of the identifier typically relevant to the user and which is unique within the context of the system." />
    </element>
    <element id="Location.managingOrganization.display">
      <path value="Location.managingOrganization.display" />
      <short value="Nombre completo del servicio asistencial" />
      <definition value="Text alternative for the resource. Plain text narrative that identifies the resource in addition to the resource reference." />
    </element>
  </differential>
</StructureDefinition>