Overview
Therecord_type field in the MedicalRecord structure categorizes the type of medical information stored. This enumeration helps organize patient health data and enables filtering and specialized handling of different record categories.
Type Enumeration
Record types are represented asu8 values ranging from 1 to 10. The contract validates this range during record creation:
Valid Record Types
General health records including:
- Medical history
- Physical examination notes
- Chronic condition documentation
- General practitioner visit summaries
- Health assessments and screenings
Laboratory test results including:
- Blood work and analysis
- Urinalysis
- Genetic testing results
- Pathology reports
- Microbiology cultures
- Biochemistry panels
Medication and prescription records including:
- Current prescriptions
- Medication history
- Dosage information
- Pharmacy dispensing records
- Drug interaction notes
- Prescription refills
Medical imaging and radiology reports including:
- X-ray reports
- MRI scan results
- CT scan findings
- Ultrasound reports
- PET scan results
- Radiologist interpretations
Large image files should be stored off-chain with only metadata and report text in the MedicalRecord due to the ~372 byte storage limit.
Immunization and vaccination documentation including:
- Vaccination dates and types
- Immunization schedules
- Vaccine lot numbers
- Booster shot records
- Adverse reaction history
- International vaccination certificates
Surgical procedures and operative reports including:
- Pre-operative assessments
- Operative notes
- Post-operative care instructions
- Anesthesia records
- Surgical complications
- Follow-up visit notes
Mental health and psychiatric records including:
- Psychiatric evaluations
- Therapy session notes
- Mental health diagnoses
- Psychological test results
- Treatment plans
- Medication management for mental health
Dental and oral health documentation including:
- Dental examination findings
- X-rays and imaging
- Treatment plans
- Procedure notes
- Orthodontic records
- Periodontal assessments
Eye care and vision records including:
- Eye examination results
- Vision prescriptions
- Contact lens fittings
- Ophthalmological procedures
- Retinal imaging
- Glaucoma monitoring
Miscellaneous medical records that don’t fit other categories including:
- Alternative medicine treatments
- Nutritional assessments
- Physical therapy notes
- Occupational health records
- Travel medicine documentation
- Any other medical documentation
Usage in Code
When creating a medical record, specify the appropriate type:Type Constants (Recommended)
For better code maintainability, define type constants in your client application:Filtering Records by Type
If using theRecordMetadata public mapping (when make_discoverable is true), you can filter patient records by type:
Storage Considerations
Data Size per Type
Different record types have varying data size requirements:| Type | Typical Size | Fits in Single Record? |
|---|---|---|
| Vaccination | ~100-200 bytes | ✅ Yes |
| Prescription | ~150-300 bytes | ✅ Yes |
| Lab Results | ~200-500 bytes | ⚠️ May need multiple |
| Imaging Reports | ~300-1000 bytes | ❌ Likely needs chunking |
| Surgical Notes | ~500-2000 bytes | ❌ Requires chunking |
Each MedicalRecord provides approximately 372 bytes of storage (12 fields × 31 bytes). For larger records, create multiple MedicalRecord instances and link them using metadata.
Chunking Large Records
For record types that exceed the 372-byte limit:Validation
The contract enforces strict type validation:Privacy Implications
Discoverable Records
Whenmake_discoverable is set to true, the record type is stored in the public RecordMetadata mapping:
Recommended Privacy Settings
| Record Type | Recommended make_discoverable |
|---|---|
| General Health | ✅ True (low sensitivity) |
| Laboratory | ✅ True (useful for tracking) |
| Prescription | ✅ True (medication management) |
| Vaccination | ✅ True (proof of vaccination) |
| Imaging | ⚠️ Case-by-case |
| Surgical | ⚠️ Case-by-case |
| Mental Health | ❌ False (high sensitivity) |
| Dental | ✅ True (low sensitivity) |
| Vision | ✅ True (low sensitivity) |
| Other | ⚠️ Case-by-case |
Best Practices
Use Specific Types: Always use the most specific record type available rather than defaulting to “Other” (type 10). This improves organization and filtering.
Consistent Categorization: Maintain consistent type assignment across your application. Document your categorization logic for edge cases.
Type-Specific Encryption: Consider using different encryption schemas or key derivation for highly sensitive types like Mental Health records.
Future Extensibility: The contract’s
version field allows for future expansion of record types beyond 1-10 in later schema versions.Related Documentation
- MedicalRecord Structure - Complete field documentation
- AccessGrant Structure - Access control for records
- RecordMetadata - Public record indexing (when discoverable)
Source Reference
Record types are documented in the contract source:- Field definition:
~/workspace/source/Salud Health Contract/src/main.leo:81 - Validation logic:
~/workspace/source/Salud Health Contract/src/main.leo:182 - Type enumeration:
~/workspace/source/Salud Health Contract/ARCHITECTURE.md:67-77