EhrIndexer
Provides work with EHR documents and groups of documents.
Functions
setEhrUser
function setEhrUser(
bytes32 userIDHash,
bytes32 ehrId,
address signer,
uint deadline,
bytes calldata signature
) external onlyAllowed(msg.sender)
Sets the association between userID and ehrID.
Parameters
userIDHash
bytes32
Hash of userID
ehrId
bytes32
EhrID
signer
address
Address of the signer of the request
deadline
uint
Expiration timestamp of the request
signature
bytes
Cryptographic signature of the request performed by the signer's key
getEhrUser
function getEhrUser(
bytes32 userIDHash
) public view returns(bytes32)
Getting ehrID for userID
Parameters
userIDHash
bytes32
Hash of userID
Return Values:
ehrId
bytes32
EhrID
setEhrSubject
function setEhrSubject(
bytes32 subjectKey,
bytes32 ehrId,
address signer,
uint deadline,
bytes calldata signature
) external onlyAllowed(msg.sender)
Sets the association between ehrID and subject.
Parameters
subjectKey
bytes32
sha3(subjectID + subjectNamespace)
ehrId
bytes32
EhrID
signer
address
Address of the signer of the request
deadline
uint
Expiration timestamp of the request
signature
bytes
Cryptographic signature of the request performed by the signer's key
addEhrDoc
function addEhrDoc(IDocs.AddEhrDocParams calldata p)
external onlyAllowed(msg.sender)
Adding a new EHR document
Parameters
getEhrDocs
function getEhrDocs(
bytes32 userIDHash,
IDocs.Type docType
) public view returns(IDocs.DocumentMeta[] memory)
Text
Parameters
userIDHash
bytes32
Hash of userID
Return Values:
getLastEhrDocByType
function getLastEhrDocByType(
bytes32 ehrId,
IDocs.Type docType
) public view returns(IDocs.DocumentMeta memory)
Retrieve the last document of the specified type.
Parameters
ehrId
bytes
EhrID
Return Values:
getDocByVersion
function getDocByVersion(
bytes32 ehrId,
IDocs.Type docType,
bytes32 docBaseUIDHash,
bytes32 version
) public view returns (IDocs.DocumentMeta memory)
Retrieve the specified version of the document
Parameters
ehrId
bytes32
EhrID
docBaseUIDHash
bytes32
Hash of document UID
version
bytes32
Document version
Return Values:
getDocByTime
function getDocByTime(
bytes32 ehrID,
IDocs.Type docType,
uint32 timestamp
) public view returns (IDocs.DocumentMeta memory)
Retrieving a document that is up to date at the specified time
Parameters
ehrID
bytes32
EhrID
Return Values:
getDocLastByBaseID
function getDocLastByBaseID(
bytes32 userIDHash,
IDocs.Type docType,
bytes32 UIDHash
) public view returns (IDocs.DocumentMeta memory)
Retrieving the latest version of the document specified by id
Parameters
userIDHash
bytes32
Hash of userID
Return Values:
deleteDoc
function deleteDoc(
bytes32 ehrId,
IDocs.Type docType,
bytes32 docBaseUIDHash,
bytes32 version,
address signer,
uint deadline,
bytes calldata signature
) external onlyAllowed(msg.sender)
Deleting a document. The actual status of the document changes to Deleted
.
Parameters
ehrId
bytes32
EhrId
docBaseUIDHash
bytes32
Hash of document UID
version
bytes32
Document version
signer
address
Address of the signer of the request
deadline
uint
Expiration timestamp of the request
signature
bytes
Cryptographic signature of the request performed by the signer's key
setAccess
function setAccess(
bytes32 accessID,
IAccessStore.Access memory a,
address signer,
uint deadline,
bytes calldata signature
) external
Sets the access level to the object
Parameters
accessID
bytes32
signer
address
Address of the signer of the request
deadline
uint
Expiration timestamp of the request
signature
bytes
Cryptographic signature of the request performed by the signer's key
docGroupCreate
function docGroupCreate(DocGroupCreateParams calldata p) external
Creating a document group
Parameters
docGroupAddDoc
function docGroupAddDoc(
bytes32 groupIDHash,
bytes32 docCIDHash,
bytes calldata docCIDEncr,
address signer,
uint deadline,
bytes calldata signature
) external
Adding a document to a group of documents
Parameters
groupIDHash
bytes32
Hash of groupID
docCIDHash
bytes32
docCIDEncr
bytes
Document CID encrypted by group key
signer
address
Address of the signer of the request
deadline
uint
Expiration timestamp of the request
signature
bytes
Cryptographic signature of the request performed by the signer's key
docGroupGetDocs
function docGroupGetDocs(bytes32 groupIdHash) external view returns (bytes[] memory)
Getting the list of documents included in the group
Parameters
groupIDHash
bytes32
Return Values:
docCIDEncrs
bytes[]
Array of CIDs of documents encrypted with the document group key
docGroupGetAttrs
function docGroupGetAttrs(
bytes32 groupIdHash
) external view returns (Attribute[] memory)
Getting group attributes
Parameters
groupIDHash
bytes32
Return Values:
Models
Attribute
struct Attribute {
Code code;
bytes value;
}
DocGroupCreateParams
struct DocGroupCreateParams {
bytes32 groupIDHash;
Attributes.Attribute[] attrs;
address signer;
uint deadline;
bytes signature;
}
IDocs.Type
enum Type {
Ehr, // 0
EhrAccess, // 1
EhrStatus , // 2
Composition, // 3
Query, // 4
Template, // 5
Directory // 6
}
IDocs.AddEhrDocParams
struct AddEhrDocParams {
Type docType;
bytes id;
bytes version;
uint32 timestamp;
Attributes.Attribute[] attrs;
address signer;
uint deadline;
bytes signature;
}
IDocs.DocumentMeta
struct DocumentMeta {
Status status;
bytes id;
bytes version;
uint32 timestamp;
bool isLast;
Attributes.Attribute[] attrs;
}
IAccessStore.AccessLevel
enum AccessLevel { NoAccess, Owner, Admin, Read }
IAccessStore.Access
struct Access {
AccessKind kind;
bytes32 idHash;
bytes idEncr; // id encrypted by access key
bytes keyEncr; // access key encrypted by user private key
AccessLevel level;
}
Last updated