#Personal-Profile
Provide a brief description of your project, its purpose, and its main features.
- Python 3.x
- Django 5.0.2
- MySQL or MariaDB
-
Clone the repository:
git clone https://github.com/xinyue66-oss/Personal-Profile.git cd Personal-Profile
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root of your project by copying the.env.example
file:cp .env.example .env
-
Fill in the values for the environment variables in the
.env
file. -
Run database migrations (use
python3
ifpython
does not point to Python 3 on your system):python manage.py makemigrations python manage.py migrate
-
Start the development server:
python manage.py runserver 0.0.0.0:8000
Provide instructions on how to use your project, including any necessary setup or configuration.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Specify the license under which the project is distributed.
Provide contact information or links to relevant profiles (e.g., GitHub, LinkedIn).
pip install pytest requests
cd api
pytest -v test.py
User Case1: User Registration and Profile Creation Actor: New User Description: A new user signs up for the system and creates their Secure Personal Profile. Steps:
- User downloads and opens the app
- User chooses to create a new account
- User provides basic information (e.g., name, email, handle)
- User sets up strong authentication (e.g., password, biometrics, public-private key pair)
- User is prompted to start adding information to their profile
- System creates a unique, portable digital container for the user’s profile
request params:
○ name: String (User's full name)
○ email: String (User's email)
○ handle: String (User's handle)
○ password: String (Encrypted)
○ biometrics: String (Encrypted)
○ public-private key pair: String:(Encrypted)
respond params:
○ user_id: String (Unique ID for the user)
○ token(token of user)
○ profile_id: String (ID of the created profile)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/users/register
respond:
○ success:
{
"user_id": 2,
"token": "adbcf08f16f04d7fd79c77ad0e1bd6e8",
"profile_id": 2,
"status": "success"
}
○ fail:
{
"status": "the email exists!"
}
database:
app_users、app_token
User Case2: Adding Government-Issued Credentials Actor: Registered User Description: User adds their driver’s license to their Secure Personal Profile. Steps:
- User navigates to the “Add Credential” section
- User selects “Government ID” and then “Driver’s License”
- User is prompted to scan or photograph their physical license
- System extracts and verifies the information
- User confirms the extracted data
- System securely stores the credential in the user’s profile
request params:
○ token(token of user)
○ credential_type: String (e.g., Driver's License)
○ credential_image: File (Scanned image or photo of the credential)
respond params:
○○ credential_id: String (ID of the added credential)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/add-credential
respond:
○ success:
{
"credential_id": 1,
"status": "success"
}
○ fail:
{
"status": "credential_type,credential_image must exist!"
}
database:
app_credential
User Case3: Selective Information Sharing Actor: User, Third-party Service Description: User shares only their age from their driver’s license with a third-party service. Steps:
- Third-party service requests age verification
- User receives notification of the request
- User chooses to share information from their driver’s license
- User selects only the “Age” field to share
- System generates a temporary, verifiable credential containing only the age
- Third-party service receives and verifies the age credential
request params:
○ token(token of user)
○ service_id: String (ID of the requesting third-party service)
○ info_field: String (e.g., Age)
respond params:
○ verification_token: String (Temporary token for the third-party to verify the information)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/share-create
respond:
○ success:
{
"verification_token": "079517a38770039662c1006252ae7d50",
"status": "success"
}
○ fail:
{
"status": "token must exist!"
}
database:
app_sharedinfo
User Case4: Setting Up Emergency Access Actor: User Description: User configures the “Break the Glass” feature for emergency situations. Steps:
- User navigates to the “Emergency Access” settings
- User selects information to be accessible in emergencies
- User defines criteria for emergency access (e.g., unconsciousness)
- User adds trusted contacts who can trigger emergency access
- System encrypts and stores the emergency information separately
request params:
○ token(token of user)
○ trusted_contacts: Array of Strings (List of trusted contacts)
○ emergency_info: Object (Details of information to be accessible)
○ criteria: Json(e.g., unconsciousness)
respond params:
○ access_id: String (ID of the added emergency_access)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/emergency-access
respond:
○ success:
{
"access_id": 1,
"status": "success"
}
○ fail:
{
"status": "token must exist!"
}
User Case5: Emergency Information Access Actor: Emergency Responder, System Description: An emergency responder accesses critical health information during an emergency. Steps:
- Emergency responder locates user’s device
- Responder initiates “Break the Glass” procedure
- Responder provides their identification and reason for access
- System verifies the responder’s credentials
- System grants access to predefined emergency information
- System logs the access event and notifies user’s emergency contacts
request params:
○ responder_id: String (ID of the emergency responder)
○ reason: String (Reason for access request)
○ email: String (email of the user)
respond params:
○ emergency_info: Object (Predefined emergency information)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/emergency-access/grant
respond:
○ success:
{
"emergency_info": "{HOME:Burnaby 4024}",
"status": "success"
}
○ fail:
{
"status": "responder_id,reason,email must exist!"
}
database:
app_emergencyaccesslog
User Case6: Configuring Privilege Rings Actor: User Description: User sets up different levels of information access for their profile. Steps:
- User accesses the “Privacy Settings” section
- User reviews default privilege rings (public, semi-private, private, restricted)
- User assigns different types of information to appropriate rings
- User can create custom rings for specific purposes
- System applies the configured privacy settings to all stored information N.B. Here, the use of the term “rings” is from the Operating Systems language. Other terms may be more helpful.
request params:
○ token(token of user)
○ assigned_data: Object (Configuration of access levels for various data)
○ ring_name
respond params:
○ ring_id(ID of the privilege_rings)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/privilege-rings
respond:
○ success:
{
"ring_id": 1,
"status": "success"
}
○ fail:
{
"status": "token has expired!"
}
database:
app_privilegerings
User Case7: Updating Personal Information
Actor: User
Description: User updates their home address in their profile, all references are updated.
Steps:
- User navigates to the “Personal Information” section
- User updates their home address
- All documents containing references to the Profile are automatically current
- This implies the Documents may have a field saying “ home address”
- This Document may retrieve and expose the address only for the Role it was intended for
N.B. This is a massive Use Case, and probably the most important. With one change, all Government
and Commercial databases pointing to this profile are updated.
request params:
○ token(token of user)
○ updated_fields: Object (Fields to be updated, e.g., home address)
respond params:
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/update-info
respond:
○ success:
{
"status": "success"
}
○ fail:
{
"status": " Json Decode Error!"
}
database:
app_profiles
User Case8: Revoking Access Actor: User Description: User revokes a third-party service’s access to their information. Steps:
- User views list of services with access to their information
- User selects a service to revoke access
- System displays what information the service currently has access to
- User confirms revocation of access
- System updates access permissions and notifies the third-party service
- The permissions may be identified as the set of Roles belonging to the third party services
request params:
○ token(token of user)
○ service_id: String (ID of the third-party service)
respond params:
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/revoke-access
respond:
○ success:
{
"status": "delete required"
}
○ fail:
{
"status": "token has expired!"
}
User Case10: Sharing Health Records with a New Doctor Actor: User, Healthcare Provider Description: User securely shares relevant health records with a new doctor. Steps:
- User receives request for health information from new doctor
- User accesses their health records in the profile
- User selects specific records to share or export (e.g., immunizations, allergies)
- User sets an optional expiration date for the shared information
- System generates a secure, time-limited access link
- User sends the access link to the doctor’s verified email
request params:
○ token(token of user)
○ health_records_info: Object (User selects specific records to share)
○ doctor_email: String (Verified email of the doctor)
○ expiration_date: Date (Optional expiration date for access)
respond params:
○ access_link: String (Link to access the health records)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/share-create-link
respond:
○ success:
{
"access_link": "2e05ac0128cffc7f3e49f75e31a1f83f",
"status": "success"
}
○ fail:
{
"status": "token has expired!"
}
database:
app_sharehealthrecords
User Case11: Creating a Public Profile Actor: User Description: User creates a public-facing profile with limited information. Steps:
- User navigates to “Public Profile” settings
- User selects information to include (e.g., name, profession, public contact method)
- User previews how their public profile will appear
- User enables or disables public profile visibility
- System generates a public link for the profile
- User can share their public profile link as needed
request params:
○ token(token of user)
○ public_info: Object (Fields to be included in the public profile)
○ visibility: Boolean (Enable or disable visibility)
respond params:
○ public_profile_link: String (URL of the public profile)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/public
respond:
○ success:
{
"public_profile_link": "aad761da7b58e73a9057fbd6b5d5e9eb",
"status": "success"
}
○ fail:
{
"status": "post required"
}
User Case19: Profile Portability and Export Actor: User Description: User exports their entire profile in a standardized, portable format. Steps:
- User chooses to export their profile
- System offers options for export format (e.g., encrypted file, printable summary)
- User selects desired format and initiates export
- System packages all profile data, maintaining structure and metadata
- User receives the exported profile along with instructions for importing elsewhere
- System logs the export event and reminds user about the sensitivity of the exported data
request params:
○ token(token of user)
respond params:
○ exported_data: (json data of user)
○ status: String (Success or error message)
request:
POST http://127.0.0.1:8000/api/v1/profile/export
respond:
○ success:
{
"exported_data": {
"profile_id": 3,
"user_id": 3,
"data": {
"email": "[email protected]",
"handle": "12"
},
"created_at": "2024-10-19 08:34",
"updated_at": "2024-10-19 09:39"
},
"status": "success"
}
○ fail:
{
"status": "post required"
}
database:
app_exportlogs