Interface I_EhrAccess

  • All Superinterfaces:
    I_SimpleCRUD
    All Known Implementing Classes:
    EhrAccess

    public interface I_EhrAccess
    extends I_SimpleCRUD
    Ehr access layer
    This interface deals with the main Ehr table as well as Status. Status provides the information related to the actual Ehr owner (eg. patient or Named Subject generally). Created by Christian Chevalley on 4/21/2015.
    • Method Detail

      • getInstance

        static I_EhrAccess getInstance​(I_DomainAccess domain,
                                       UUID partyId,
                                       UUID systemId,
                                       UUID directoryId,
                                       UUID accessId,
                                       UUID ehrId)
        get a new Ehr access layer instance
        Parameters:
        domain - SQL access
        partyId - owner UUID (patient)
        systemId - system on which the Ehr is initiated (UUID)
        directoryId - optional directory structure Id
        accessId - optional access strategy Id
        ehrId - optional custom ehrID
        Returns:
        I_EhrAccess
        Throws:
        InternalServerException - if creating or retrieving system failed
      • retrieveInstanceBySubject

        static UUID retrieveInstanceBySubject​(I_DomainAccess domainAccess,
                                              String subjectId,
                                              String issuerSpace)
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification with an identifier
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectId - the subject code or number
        issuerSpace - the issuer identifier
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstanceBySubject

        static UUID retrieveInstanceBySubject​(I_DomainAccess domainAccess,
                                              UUID subjectUuid)
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject UUID
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectUuid - the subject uuid
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstanceBySubjectExternalRef

        static UUID retrieveInstanceBySubjectExternalRef​(I_DomainAccess domainAccess,
                                                         String subjectId,
                                                         String issuerSpace)
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification by external reference
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectId - the subject code or number
        issuerSpace - the namespace
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstanceByStatus

        static I_EhrAccess retrieveInstanceByStatus​(I_DomainAccess domainAccess,
                                                    UUID ehrId,
                                                    UUID status,
                                                    int version)
        retrieve an Ehr for a known status entry
        Parameters:
        domainAccess - SQL access
        ehrId - EHR ID of current context
        status - status UUID
        version - optional version, will assume latest if null
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstance

        static I_EhrAccess retrieveInstance​(I_DomainAccess domainAccess,
                                            UUID ehrId)
        retrieve the Ehr entry from its id
        Parameters:
        domainAccess - SQL access
        ehrId - the Ehr UUID
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - when either no EHR for ID, or problem with data structure of EHR, or DB inconsistency
      • fetchSubjectIdentifiers

        static Map<String,​Object> fetchSubjectIdentifiers​(I_DomainAccess domainAccess,
                                                                UUID ehrId)
        retrieve the list of identifiers for a subject owning an Ehr
        the identifiers are formatted as: "CODE:ISSUER"
        Parameters:
        domainAccess - SQL access
        ehrId - the Ehr Id to search the subject from
        Returns:
        a list of identifiers
        Throws:
        IllegalArgumentException - when no EHR found for ID
      • setModifiable

        void setModifiable​(Boolean modifiable)
      • setQueryable

        void setQueryable​(Boolean queryable)
      • update

        Boolean update​(UUID committerId,
                       UUID systemId,
                       ContributionDef.ContributionState state,
                       I_ConceptAccess.ContributionChangeType contributionChangeType,
                       String description)
        Updates the whole EHR access in the DB, e.g. to update the status. Embeds contribution and audit handling.
        Parameters:
        committerId - ID of committer
        systemId - ID of committing system
        state - State of contribution
        contributionChangeType - Change type of contribution
        description - Description field
        Returns:
        True for success
        Throws:
        InvalidApiParameterException - when marshalling of EHR_STATUS / OTHER_DETAILS failed
      • setAccess

        void setAccess​(UUID access)
        set access id
        Parameters:
        access - UUID
      • setDirectory

        void setDirectory​(UUID directory)
        set directory id
        Parameters:
        directory - UUID
      • setSystem

        void setSystem​(UUID system)
        set system Id
        Parameters:
        system - UUID
      • reload

        UUID reload()
        TODO: doc or is this one really not needed anymore? delete if so.
        Returns:
        Throws:
        IllegalArgumentException - when instance's EHR ID can't be matched to existing one
      • isNew

        boolean isNew()
        check if Ehr is newly created (uncommitted)
        Returns:
        true if new, false otherwise
      • getParty

        UUID getParty()
      • setParty

        void setParty​(UUID partyId)
      • getId

        UUID getId()
      • isModifiable

        Boolean isModifiable()
      • isQueryable

        Boolean isQueryable()
      • getSystemId

        UUID getSystemId()
      • getStatusId

        UUID getStatusId()
      • getDirectoryId

        UUID getDirectoryId()
      • getAccessId

        UUID getAccessId()
      • setStatusAccess

        void setStatusAccess​(I_StatusAccess statusAccess)
      • setOtherDetails

        void setOtherDetails​(com.nedap.archie.rm.datastructures.ItemStructure otherDetails,
                             String templateId)
      • getOtherDetails

        com.nedap.archie.rm.datastructures.ItemStructure getOtherDetails()
      • setStatus

        void setStatus​(com.nedap.archie.rm.ehr.EhrStatus status)
      • getStatus

        com.nedap.archie.rm.ehr.EhrStatus getStatus()
        Gets latest EHR_STATUS, which is attached to this EHR instance after retrieving it.
        Returns:
        Latest EHR_STATUS
      • getLastVersionNumberOfStatus

        Integer getLastVersionNumberOfStatus​(I_DomainAccess domainAccess,
                                             UUID ehrStatusId)
        Get latest version number of EHR_STATUS by versioned object UID.
        Parameters:
        domainAccess - access
        ehrStatusId - versioned object UID
        Returns:
        version number
      • getEhrStatusVersionFromTimeStamp

        int getEhrStatusVersionFromTimeStamp​(Timestamp time)
        Get a specific version number of the associated EHR_STATUS of this EhrAccess by timestamp. General idea behind the algorithm: 'what version was the top version at moment T?'
        Parameters:
        time - Timestamp
        Returns:
        version number
      • getInitialTimeOfVersionedEhrStatus

        Timestamp getInitialTimeOfVersionedEhrStatus()
        Get initial time (or time of oldest record) of the status object linked to the EHR of this EhrAccess instance.
        Returns:
        time as Timestamp
      • getNumberOfEhrStatusVersions

        Integer getNumberOfEhrStatusVersions()
        Get number of available versions of EhrStatus' linked to this EhrAccess instance.
        Returns:
        Number of versions