Initialize the contract with an admin address.
Parameters:
admin: The address that will have admin privileges
Returns: Result<(), ContractError>
Example:
client.initialize(&admin_address);Register a new user in the system.
Parameters:
user: User's Stellar addressrole: One ofPatient,Optometrist,Ophthalmologist,Adminname: Display name
Returns: Result<(), ContractError>
Retrieve user information.
Parameters:
user: User's Stellar address
Returns: Result<User, ContractError>
Add a new vision record.
Parameters:
patient: Patient's addressprovider: Provider's address (must authenticate)record_type: Type of record (Examination,Prescription,Diagnosis, etc.)data_hash: IPFS/off-chain hash of encrypted data
Returns: Result<u64, ContractError> - Record ID
Retrieve a record by ID.
Parameters:
record_id: The record ID
Returns: Result<VisionRecord, ContractError>
Get all record IDs for a patient.
Parameters:
patient: Patient's address
Returns: Vec<u64>
Grant access to a user.
Parameters:
patient: Patient granting access (must authenticate)grantee: User receiving accesslevel: Access level (None,Read,Write,Full)duration_seconds: How long access is valid
Returns: Result<(), ContractError>
Check access level for a user.
Parameters:
patient: Patient's addressgrantee: User to check
Returns: AccessLevel
Revoke access from a user.
Parameters:
patient: Patient revoking access (must authenticate)grantee: User losing access
Returns: Result<(), ContractError>
Get the admin address.
Returns: Result<Address, ContractError>
Check if contract is initialized.
Returns: bool
Get total number of records.
Returns: u64
Get contract version.
Returns: u32
enum Role {
Patient,
Optometrist,
Ophthalmologist,
Admin,
}enum AccessLevel {
None,
Read,
Write,
Full,
}enum RecordType {
Examination,
Prescription,
Diagnosis,
Treatment,
Surgery,
LabResult,
}enum ContractError {
NotInitialized,
AlreadyInitialized,
Unauthorized,
UserNotFound,
RecordNotFound,
InvalidInput,
AccessDenied,
Paused,
}Initialize AI integration with an admin and anomaly threshold.
register_provider(caller: Address, provider_id: u32, operator: Address, name: String, model: String, endpoint_hash: String)
Register an approved AI provider.
submit_analysis_request(caller: Address, provider_id: u32, patient: Address, record_id: u64, input_hash: String, task_type: String)
Submit a new AI analysis request and return a request ID.
store_analysis_result(caller: Address, request_id: u64, output_hash: String, confidence_bps: u32, anomaly_score_bps: u32)
Store provider output and return resulting request status (Completed or Flagged).
Verify or reject an AI analysis result.
For complete type definitions and flow details, see docs/ai_integration.md.