Overview
The Data Sharing feature allows you to grant read-only access to your health information to trusted individuals. Share your complete health tracking history including weight measurements, blood pressure readings, exercise logs, and medical appointments with anyone who has a Health Manager account.You maintain complete control over who can view your data and can revoke access at any time. Shared viewers have read-only access and cannot edit or delete your information.
How Data Sharing Works
Sharing Model
Health Manager uses a viewer-based sharing system:- Owner: You (the person creating health records)
- Viewers: People you grant access to (family, doctors, caregivers)
- Permissions: Viewers have read-only access to all your health data
- Scope: When you share, viewers see your complete health history
What Gets Shared
When you grant access to a viewer, they can see:Calendar View
Your complete calendar with all activity indicators and the ability to view day details.
Weight Measurements
All historical weight entries with dates, values, and trends over time.
Blood Pressure
Complete cardiovascular readings including systolic, diastolic, and heart rate measurements.
Medical Appointments
Scheduled and past appointments with descriptions and the ability to download attached files.
Granting Access
Adding a Viewer
- Navigate to Profile Settings: Access your account settings
- Find Data Sharing Section: Locate the “Share Data” or “Compartir Datos” section
- Search for User: Type the username of the person you want to grant access to
- Select from Results: Click on the correct user from the search results
- Confirm: Add the viewer to your authorized list
Search Functionality
The username search is dynamic and user-friendly:- Activates after typing 2 characters
- Shows up to 5 matching usernames
- Excludes yourself from results
- Clears automatically when you select a user
Validation and Safeguards
The system prevents common mistakes:-
User Must Exist:
Error: “No encontramos ningún usuario con ese Nick.”
-
Cannot Share with Yourself:
-
No Duplicate Access:
Managing Viewers
Viewing Your Authorized List
The data sharing interface displays:- Complete list of users with access to your data
- Usernames or display names
- Option to remove access for each viewer
Revoking Access
Remove a viewer’s access instantly:- Click Remove: Select the remove button next to the viewer’s name
- Instant Revocation: Access is removed immediately
- No Confirmation Needed: The viewer can no longer see your data
- Seamless Process: The viewer is not notified of the revocation
Revoked viewers immediately lose access to your health data. They can be re-added later if needed.
Viewer Experience
Accessing Shared Data
When someone shares their data with you:- You can view their calendar from your account
- All their health activities are visible
- You see the same calendar interface they see
- Full historical data is available
Viewer Mode Indicators
When viewing another user’s data, the interface clearly indicates viewer mode:- Blue banner at the top: “Modo Espectador” (Viewer Mode)
- Message: “Estás viendo los datos de otro usuario. No puedes crear ni editar registros.”
- FAB (Floating Action Button) is hidden
- No edit or delete buttons on entries
What Viewers Can Do
✅ Allowed Actions:- View complete calendar with all activities
- Navigate between months
- Click days to see detailed entries
- Download appointment attachments
- See weight trends and statistics
- Review blood pressure history
- View upcoming and past appointments
- Cannot create new entries
- Cannot edit existing data
- Cannot delete records
- Cannot upload files
- Cannot modify appointments
Data Sharing Relationships
Database Structure
The sharing system uses a many-to-many relationship:user_viewer
user_id- The person sharing their dataviewer_id- The person who can view the data- Supports many-to-many relationships
- You can have multiple viewers
- You can view multiple people’s data
Session Management
When viewing shared data:- Session stores whose data you’re currently viewing
- Defaults to your own user ID
- All queries filter by this context-aware user ID
- Ensures data isolation and security
Use Cases
Family Caregiving
Share your data with family members who help manage your health, medications, or attend appointments with you.
Remote Monitoring
Allow healthcare providers to monitor your vital signs and activity levels between appointments.
Health Accountability
Share with a workout buddy or accountability partner to stay motivated with fitness goals.
Emergency Access
Grant access to emergency contacts who may need your medical history in urgent situations.
Privacy and Security
Data Protection
Explicit Consent
No one can view your data unless you explicitly grant them access by username.
Read-Only Access
Viewers cannot modify, delete, or corrupt your health records in any way.
Instant Revocation
Remove access at any moment without warning or notification to the viewer.
User Control
You maintain complete control over who sees your data and for how long.
Security Measures
The system implements multiple security layers:- Authentication Required: Both parties must have Health Manager accounts
- Query Filtering: All data queries respect the user context
- Write Protection: Viewers cannot modify data at the controller level
- Session Isolation: Each session tracks the current viewing context
- No Cross-Contamination: Impossible to accidentally write to another user’s records
Best Practices
Trust-Based Sharing
Only share your health data with people you trust completely, as they’ll have access to sensitive medical information.
Regular Audits
Periodically review your authorized viewers list and remove access for people who no longer need it.
Clear Communication
Inform viewers when you grant them access so they know how to find your shared data.
Specific Purpose
Consider granting temporary access for specific events (surgery recovery, treatment period) and revoking after.
Technical Implementation
ShareData Livewire Component
Component:App\Livewire\Profile\ShareData
Public Properties:
updatedSearch()- Reactive search triggered on inputselectUser($username)- Handles user selection from resultsaddViewer()- Validates and grants accessremoveViewer($id)- Revokes accessrender()- Displays viewers list
Context-Aware Queries
TheHasContext trait provides user context:
- Calendar
- Weight history
- Blood pressure logs
- Appointment lists
Troubleshooting
Common Issues
“No encontramos ningún usuario con ese Nick”- The username doesn’t exist in the system
- Check for typos in the username
- Ensure the person has created a Health Manager account
- You’ve already granted access to this person
- Check your authorized viewers list
- No need to add them again
- Verify the viewer is in your authorized list
- Ensure they’re looking at your shared data (not their own)
- Check that they’re using the correct account
Related Features
- Interactive Calendar - Main interface viewers use to see shared data
- Health Tracking - Metrics that can be shared with viewers
- Medical Appointments - Appointments visible to authorized viewers
