Pharmaceutical Relations Database
Purpose: Pharmaceutical company relations, drug campaigns, clinical trials, and compliance Database: Separate PostgreSQL database (
pharma_db) Multi-Tenancy: Pharma company as tenant
Overview
The Pharma database is intentionally separate from the main Kulcare database. This architectural decision (see ADR-011) is driven by:
- Different Tenant Model: Pharma companies are tenants, not healthcare facilities
- Data Isolation: Marketing data should not mix with PHI
- Compliance Requirements: Clinical trials require FDA/DCGI-level isolation
- Conflict of Interest: Sunshine Act / transparency reporting requires separation
- Scaling: High-volume campaign data with different access patterns
Database Architecture
+------------------------------------------------------------------+
| PHARMA DATABASE (pharma_db) |
+------------------------------------------------------------------+
| |
| +-----------------------------+ |
| | PHARMA SCHEMA | |
| +-----------------------------+ |
| | pharma_companies | |
| | pharma_users | |
| | medical_reps | |
| | rep_territories | |
| | campaigns | |
| | campaign_targets | |
| | campaign_materials | |
| | drug_promotions | |
| | doctor_engagements | |
| | engagement_analytics | |
| +-----------------------------+ |
| |
| +-----------------------------+ |
| | TRIALS SCHEMA | |
| +-----------------------------+ |
| | clinical_trials | |
| | trial_sites | |
| | trial_investigators | |
| | trial_enrollments | |
| | trial_protocols | |
| +-----------------------------+ |
| |
| +-----------------------------+ |
| | COMPLIANCE SCHEMA | |
| +-----------------------------+ |
| | disclosure_records | |
| | gift_tracking | |
| | pharma_audit_logs | |
| +-----------------------------+ |
| |
| +-----------------------------+ |
| | REFERENCE SCHEMA | |
| +-----------------------------+ |
| | practitioners_sync | <-- Sync from Kulcare |
| | drugs_sync | <-- Sync from Kulcare |
| +-----------------------------+ |
| |
+------------------------------------------------------------------+
INTEGRATION WITH KULCARE DB (API-based)
+------------------------------------------------------------------+
| KULCARE DATABASE |
+------------------------------------------------------------------+
| |
| identity.practitioners ----API----> pharma.practitioners_sync |
| reference.drugs ----API----> pharma.drugs_sync |
| |
| (Read-only sync, anonymized where needed) |
| |
+------------------------------------------------------------------+Pharma Schema
Entities
Entity: PharmaCompany
Purpose: Pharmaceutical company (tenant entity)
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| name | String | Yes | Company name |
| legal_name | String | No | Legal entity name |
| company_type | Enum | Yes | manufacturer, distributor, cso |
| country_code | String | Yes | Headquarters country |
| identifiers | JSONB | No | Business identifiers |
| primary_contact_name | String | No | Primary contact |
| primary_contact_email | String | No | Contact email |
| primary_contact_phone | String | No | Contact phone |
| address | JSONB | No | Headquarters address |
| website | String | No | Company website |
| logo_url | String | No | Company logo |
| therapeutic_areas | String[] | No | Focus therapeutic areas |
| status | Enum | Yes | active, suspended, terminated |
| contract_start_date | Date | No | Platform contract start |
| contract_end_date | Date | No | Platform contract end |
| settings | JSONB | No | Company-level settings |
| created_at | Timestamp | Yes | Registration date |
Company Type Values:
manufacturer- Drug manufacturerdistributor- Drug distributorcso- Contract Sales Organization
Relationships:
- Has many: PharmaUsers, MedicalReps, Campaigns, DrugPromotions, ClinicalTrials
Entity: PharmaUser
Purpose: Pharma company user accounts
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| String | Yes | Login email | |
| password_hash | String | Yes | Hashed password |
| first_name | String | Yes | First name |
| last_name | String | No | Last name |
| role | Enum | Yes | admin, manager, analyst, rep |
| permissions | JSONB | No | Granular permissions |
| status | Enum | Yes | active, suspended |
| last_login_at | Timestamp | No | Last login |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany
Entity: MedicalRep
Purpose: Medical/sales representatives
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| pharma_user_id | UUID | No | Linked user account |
| employee_id | String | No | Employee ID |
| first_name | String | Yes | First name |
| last_name | String | No | Last name |
| String | No | Work email | |
| phone | String | No | Phone number |
| manager_id | UUID | No | Reporting manager |
| therapeutic_specialization | String[] | No | Focus areas |
| certification_status | Enum | No | pending, certified, expired |
| certification_expiry | Date | No | Certification expiry |
| status | Enum | Yes | active, on_leave, terminated |
| hire_date | Date | No | Start date |
| termination_date | Date | No | End date |
Relationships:
- Belongs to: PharmaCompany, PharmaUser
- Self-referential: manager_id
- Has many: RepTerritories, DoctorEngagements
Entity: RepTerritory
Purpose: Territory assignments for medical reps
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| medical_rep_id | UUID | Yes | Assigned rep |
| territory_name | String | Yes | Territory name |
| territory_type | Enum | Yes | geographic, specialty, account |
| geographic_bounds | JSONB | No | Geographic definition |
| assigned_practitioners | UUID[] | No | Assigned doctor IDs |
| target_metrics | JSONB | No | Performance targets |
| effective_date | Date | Yes | Assignment start |
| end_date | Date | No | Assignment end |
| is_active | Boolean | Yes | Active assignment |
Territory Type Values:
geographic- Geographic area (city, region)specialty- Specialty-based (all cardiologists)account- Key account management
Relationships:
- Belongs to: PharmaCompany, MedicalRep
Campaigns
Entity: Campaign
Purpose: Marketing campaigns for drug promotion
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| name | String | Yes | Campaign name |
| campaign_type | Enum | Yes | awareness, launch, reminder, sample, cme |
| description | Text | No | Campaign description |
| therapeutic_area | String | No | Target therapeutic area |
| target_specialty | String | No | Target specialty |
| target_criteria | JSONB | No | Targeting rules |
| start_date | Date | Yes | Campaign start |
| end_date | Date | No | Campaign end |
| budget | Decimal | No | Campaign budget |
| budget_spent | Decimal | No | Amount spent |
| currency | String | No | Currency code |
| status | Enum | Yes | draft, active, paused, completed, cancelled |
| goals | JSONB | No | Campaign goals |
| created_by_id | UUID | No | Creator |
| created_at | Timestamp | Yes | Creation date |
Campaign Type Values:
awareness- Disease awareness campaignlaunch- New drug launchreminder- Prescription remindersample- Sample distributioncme- Continuing medical education
Target Criteria Structure:
{
"specialties": ["cardiology", "internal_medicine"],
"geographic": {
"countries": ["IN"],
"states": ["Karnataka", "Tamil Nadu"],
"cities": ["Bangalore", "Chennai"]
},
"prescribing_volume": {
"min_monthly": 50,
"therapeutic_area": "cardiovascular"
},
"exclude_competitors": ["drug_xyz"]
}Relationships:
- Belongs to: PharmaCompany
- Has many: CampaignTargets, CampaignMaterials, DrugPromotions
Entity: CampaignTarget
Purpose: Individual practitioners targeted by campaigns
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| campaign_id | UUID | Yes | Parent campaign |
| practitioner_sync_id | UUID | Yes | Synced practitioner |
| assigned_rep_id | UUID | No | Assigned rep |
| priority | Enum | No | high, medium, low |
| target_status | Enum | Yes | pending, contacted, engaged, converted, declined |
| contact_attempts | Integer | No | Number of attempts |
| last_contact_date | Date | No | Last contact |
| notes | Text | No | Notes |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany, Campaign, MedicalRep
- References: practitioners_sync
Entity: CampaignMaterial
Purpose: Marketing materials for campaigns
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| campaign_id | UUID | No | Parent campaign (if campaign-specific) |
| material_type | Enum | Yes | brochure, presentation, sample_kit, video, email_template |
| name | String | Yes | Material name |
| description | Text | No | Description |
| file_url | String | No | File URL |
| approval_status | Enum | Yes | draft, pending_approval, approved, rejected |
| approved_by | String | No | Approver |
| approved_at | Timestamp | No | Approval date |
| expiry_date | Date | No | Material expiry |
| usage_count | Integer | No | Times used |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany, Campaign
Entity: DrugPromotion
Purpose: Drug-specific promotion details
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| campaign_id | UUID | No | Parent campaign |
| drug_sync_id | UUID | Yes | Synced drug reference |
| promotion_type | Enum | Yes | detailing, sampling, speaker_program, journal_ad |
| key_messages | JSONB | No | Approved messaging |
| competitor_positioning | JSONB | No | Competitor comparison |
| target_indications | String[] | No | Target indications |
| contraindication_warnings | Text | No | Required warnings |
| is_active | Boolean | Yes | Active promotion |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany, Campaign
- References: drugs_sync
Engagements
Entity: DoctorEngagement
Purpose: Interactions between reps and doctors
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| medical_rep_id | UUID | Yes | Rep who engaged |
| practitioner_sync_id | UUID | Yes | Engaged doctor |
| campaign_id | UUID | No | Related campaign |
| engagement_type | Enum | Yes | call, visit, virtual_meeting, email, webinar, conference |
| engagement_date | Timestamp | Yes | Engagement time |
| duration_minutes | Integer | No | Duration |
| location | String | No | Location (if in-person) |
| topics_discussed | String[] | No | Discussion topics |
| drugs_detailed | UUID[] | No | Drugs discussed |
| materials_used | UUID[] | No | Materials presented |
| samples_provided | JSONB | No | Samples given |
| outcome | Enum | No | positive, neutral, negative, follow_up_needed |
| next_action | Text | No | Follow-up action |
| next_action_date | Date | No | Follow-up date |
| notes | Text | No | Engagement notes |
| created_at | Timestamp | Yes | Record creation |
Engagement Type Values:
call- Phone callvisit- In-person visitvirtual_meeting- Video meetingemail- Email communicationwebinar- Webinar attendanceconference- Conference meeting
Samples Provided Structure:
[
{ "drug_id": "uuid", "drug_name": "DrugX", "quantity": 10, "batch_number": "B123" }
]Relationships:
- Belongs to: PharmaCompany, MedicalRep, Campaign
- References: practitioners_sync
Entity: EngagementAnalytics
Purpose: Aggregated engagement metrics
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| practitioner_sync_id | UUID | Yes | Doctor reference |
| period_start | Date | Yes | Period start |
| period_end | Date | Yes | Period end |
| total_engagements | Integer | No | Total interactions |
| engagement_by_type | JSONB | No | Breakdown by type |
| samples_received | JSONB | No | Samples received |
| estimated_prescribing_change | Decimal | No | Prescribing change % |
| engagement_score | Decimal | No | Engagement score (0-100) |
| last_engagement_date | Date | No | Most recent engagement |
| calculated_at | Timestamp | Yes | Calculation time |
Relationships:
- Belongs to: PharmaCompany
- References: practitioners_sync
Trials Schema
Clinical Trials
Entity: ClinicalTrial
Purpose: Clinical trial definitions
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Sponsoring company |
| trial_id | String | Yes | Official trial ID (NCT number) |
| title | String | Yes | Trial title |
| short_title | String | No | Short title |
| phase | Enum | Yes | phase_1, phase_2, phase_3, phase_4, observational |
| study_type | Enum | Yes | interventional, observational |
| therapeutic_area | String | No | Therapeutic area |
| indication | String | No | Target indication |
| drug_sync_id | UUID | No | Study drug |
| protocol_number | String | No | Protocol number |
| protocol_version | String | No | Current version |
| status | Enum | Yes | planning, recruiting, active, completed, terminated, suspended |
| sponsor_type | Enum | No | industry, investigator_initiated, government |
| target_enrollment | Integer | No | Target participants |
| actual_enrollment | Integer | No | Actual enrolled |
| start_date | Date | No | Trial start |
| estimated_end_date | Date | No | Estimated completion |
| actual_end_date | Date | No | Actual completion |
| regulatory_approvals | JSONB | No | Approval details |
| created_at | Timestamp | Yes | Creation date |
Phase Values:
phase_1- Phase I (safety)phase_2- Phase II (efficacy)phase_3- Phase III (confirmatory)phase_4- Phase IV (post-marketing)observational- Observational study
Regulatory Approvals Structure:
{
"india": {
"dcgi_approval": "DCGI/2024/123",
"ethics_approval": "EC/2024/456",
"ctri_registration": "CTRI/2024/01/789"
},
"usa": {
"fda_ind": "IND123456",
"irb_approval": "IRB-2024-001"
}
}Relationships:
- Belongs to: PharmaCompany
- References: drugs_sync
- Has many: TrialSites, TrialInvestigators, TrialEnrollments, TrialProtocols
Entity: TrialSite
Purpose: Facilities participating in trials
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| clinical_trial_id | UUID | Yes | Parent trial |
| facility_name | String | Yes | Site name |
| facility_address | JSONB | No | Site address |
| country_code | String | Yes | Country |
| site_number | String | No | Site identifier |
| status | Enum | Yes | pending, active, completed, withdrawn |
| activation_date | Date | No | Site activation |
| target_enrollment | Integer | No | Site target |
| actual_enrollment | Integer | No | Site enrolled |
| principal_investigator_id | UUID | No | Lead PI |
| ethics_approval_number | String | No | Local ethics approval |
| ethics_approval_date | Date | No | Ethics approval date |
| contract_status | Enum | No | pending, signed, expired |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany, ClinicalTrial
- Has many: TrialInvestigators, TrialEnrollments
Entity: TrialInvestigator
Purpose: Investigators at trial sites
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| clinical_trial_id | UUID | Yes | Parent trial |
| trial_site_id | UUID | Yes | Site |
| practitioner_sync_id | UUID | No | Synced practitioner (if in system) |
| investigator_name | String | Yes | Full name |
| credentials | String | No | Credentials |
| String | No | Contact email | |
| role | Enum | Yes | principal, sub, coordinator |
| cv_on_file | Boolean | No | CV available |
| gcp_certified | Boolean | No | GCP training current |
| gcp_expiry_date | Date | No | GCP expiry |
| status | Enum | Yes | active, inactive |
Role Values:
principal- Principal Investigatorsub- Sub-Investigatorcoordinator- Study Coordinator
Relationships:
- Belongs to: PharmaCompany, ClinicalTrial, TrialSite
- References: practitioners_sync (optional)
Entity: TrialEnrollment
Purpose: Anonymized patient enrollments in trials
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| clinical_trial_id | UUID | Yes | Parent trial |
| trial_site_id | UUID | Yes | Enrolling site |
| anonymous_id | String | Yes | Anonymous patient ID |
| screening_number | String | No | Screening number |
| randomization_number | String | No | Randomization number |
| treatment_arm | String | No | Assigned arm |
| enrollment_date | Date | Yes | Enrollment date |
| status | Enum | Yes | screening, enrolled, active, completed, withdrawn, screen_failure |
| withdrawal_date | Date | No | Withdrawal date |
| withdrawal_reason | String | No | Withdrawal reason |
| demographics | JSONB | No | Anonymized demographics |
| consent_date | Date | No | Consent date |
| consent_version | String | No | Consent form version |
| created_at | Timestamp | Yes | Record creation |
Demographics Structure (anonymized):
{
"age_range": "45-54",
"gender": "male",
"ethnicity": "asian",
"country": "IN"
}Note: This table contains only anonymized data. The anonymous_id is generated by the main Kulcare system during consent and shared with the pharma database. No PHI is stored here.
Relationships:
- Belongs to: PharmaCompany, ClinicalTrial, TrialSite
Entity: TrialProtocol
Purpose: Protocol documents and versions
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| clinical_trial_id | UUID | Yes | Parent trial |
| version_number | String | Yes | Version (e.g., "1.0", "2.1") |
| title | String | No | Version title |
| document_url | String | No | Document URL |
| effective_date | Date | Yes | Effective date |
| summary_of_changes | Text | No | Changes from previous |
| approval_date | Date | No | IRB/EC approval date |
| status | Enum | Yes | draft, approved, superseded |
| created_at | Timestamp | Yes | Creation date |
Relationships:
- Belongs to: PharmaCompany, ClinicalTrial
Compliance Schema
Disclosure and Tracking
Entity: DisclosureRecord
Purpose: Sunshine Act / transparency disclosures
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Reporting company |
| practitioner_sync_id | UUID | Yes | Recipient doctor |
| disclosure_year | Integer | Yes | Reporting year |
| disclosure_type | Enum | Yes | payment, ownership, research |
| category | Enum | Yes | consulting, speaking, travel, food, gift, research, royalty |
| amount | Decimal | Yes | Value in USD |
| original_currency | String | No | Original currency |
| original_amount | Decimal | No | Original amount |
| payment_date | Date | No | Payment/transfer date |
| description | Text | No | Description |
| related_drug_ids | UUID[] | No | Related drugs |
| reporting_status | Enum | Yes | pending, submitted, published |
| submission_date | Date | No | Submission to CMS/authority |
| publication_date | Date | No | Public disclosure date |
| created_at | Timestamp | Yes | Record creation |
Disclosure Type Values:
payment- Direct paymentownership- Ownership/investment interestresearch- Research payment
Category Values (Sunshine Act categories):
consulting- Consulting feesspeaking- Speaker/faculty feestravel- Travel and lodgingfood- Food and beveragegift- Giftsresearch- Research paymentsroyalty- Royalties/licenseseducation- Education
Relationships:
- Belongs to: PharmaCompany
- References: practitioners_sync
Entity: GiftTracking
Purpose: Track gifts, samples, and transfers of value
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| medical_rep_id | UUID | No | Providing rep |
| practitioner_sync_id | UUID | Yes | Recipient |
| gift_type | Enum | Yes | sample, promotional, educational, meal, travel |
| description | String | Yes | Item description |
| value | Decimal | Yes | Value in local currency |
| currency | String | Yes | Currency code |
| value_usd | Decimal | No | Value in USD |
| quantity | Integer | No | Quantity |
| transfer_date | Date | Yes | Transfer date |
| location | String | No | Transfer location |
| purpose | String | No | Business purpose |
| approval_required | Boolean | No | Required approval |
| approved_by_id | UUID | No | Approver |
| approved_at | Timestamp | No | Approval time |
| recipient_acknowledged | Boolean | No | Recipient confirmed |
| created_at | Timestamp | Yes | Record creation |
Gift Type Values:
sample- Drug samplespromotional- Promotional itemseducational- Educational materialsmeal- Mealstravel- Travel reimbursement
Relationships:
- Belongs to: PharmaCompany, MedicalRep
- References: practitioners_sync
Entity: PharmaAuditLog
Purpose: Compliance audit trail
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier |
| pharma_company_id | UUID | Yes | Parent company |
| user_id | UUID | No | Acting user |
| action | Enum | Yes | create, update, delete, view, export, submit |
| resource_type | String | Yes | Entity type |
| resource_id | UUID | No | Entity ID |
| description | Text | No | Action description |
| old_values | JSONB | No | Before values |
| new_values | JSONB | No | After values |
| ip_address | String | No | Client IP |
| user_agent | String | No | Client info |
| compliance_relevant | Boolean | No | Compliance audit item |
| created_at | Timestamp | Yes | Action time |
Relationships:
- Belongs to: PharmaCompany, PharmaUser
Reference Schema (Sync)
Synced Data from Kulcare
Entity: PractitionersSync
Purpose: Synced practitioner data for targeting (read-only)
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier (same as Kulcare) |
| external_id | String | No | Kulcare practitioner ID |
| first_name | String | Yes | First name |
| last_name | String | No | Last name |
| display_name | String | No | Display name |
| specialty | String | No | Primary specialty |
| subspecialty | String | No | Subspecialty |
| qualifications | JSONB | No | Qualifications |
| city | String | No | City |
| state | String | No | State |
| country_code | String | No | Country |
| facility_names | String[] | No | Associated facilities |
| estimated_patient_volume | String | No | Volume tier |
| last_synced_at | Timestamp | Yes | Last sync time |
Note: This is read-only data synced from Kulcare. Updates flow one-way from Kulcare to Pharma DB.
Entity: DrugsSync
Purpose: Synced drug catalog (read-only)
Attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Primary identifier (same as Kulcare) |
| external_id | String | No | Kulcare drug ID |
| brand_name | String | Yes | Brand name |
| generic_name | String | No | Generic name |
| manufacturer | String | No | Manufacturer |
| therapeutic_class | String | No | Therapeutic class |
| formulation | String | No | Formulation |
| strength | String | No | Strength |
| schedule | String | No | Schedule (if controlled) |
| country_code | String | No | Country of registration |
| is_active | Boolean | Yes | Active in market |
| last_synced_at | Timestamp | Yes | Last sync time |
Note: This is read-only data synced from Kulcare reference tables.
Integration Patterns
API-Based Synchronization
The pharma database receives data from Kulcare via API:
Kulcare API Pharma DB
----------- ---------
GET /api/v1/practitioners/sync --> practitioners_sync (upsert)
GET /api/v1/drugs/sync --> drugs_sync (upsert)Sync Rules
- Practitioners: Synced with anonymized volume data, no PHI
- Drugs: Full catalog sync for campaign targeting
- Frequency: Daily incremental, weekly full sync
- Direction: One-way (Kulcare -> Pharma)
Clinical Trial Enrollment Link
When a patient consents to a clinical trial:
- Consent is recorded in Kulcare (
clinical.patient_consents) - An
anonymous_idis generated - Only
anonymous_id+ anonymized demographics shared with Pharma DB - PHI stays in Kulcare, trial data in Pharma DB
Kulcare Pharma DB
------- ---------
patient_consents trial_enrollments
- patient_id - anonymous_id (from Kulcare)
- trial_id - demographics (anonymized)
- consent_date - enrollment_status
- anonymous_id (generated)Security Considerations
- Database Isolation: Separate PostgreSQL instance
- No PHI: Pharma DB never contains PHI
- Read-Only Sync: Cannot write back to Kulcare
- Audit Logging: All access logged for compliance
- Encryption: Data encrypted at rest and in transit
- Access Control: Company-based isolation (RLS)
Entity Summary
| Schema | Entity | Description |
|---|---|---|
| pharma | PharmaCompany | Pharmaceutical company (tenant) |
| pharma | PharmaUser | Company user accounts |
| pharma | MedicalRep | Sales representatives |
| pharma | RepTerritory | Territory assignments |
| pharma | Campaign | Marketing campaigns |
| pharma | CampaignTarget | Targeted practitioners |
| pharma | CampaignMaterial | Marketing materials |
| pharma | DrugPromotion | Drug promotion details |
| pharma | DoctorEngagement | Rep-doctor interactions |
| pharma | EngagementAnalytics | Aggregated metrics |
| trials | ClinicalTrial | Trial definitions |
| trials | TrialSite | Participating sites |
| trials | TrialInvestigator | Site investigators |
| trials | TrialEnrollment | Anonymized enrollments |
| trials | TrialProtocol | Protocol versions |
| compliance | DisclosureRecord | Sunshine Act disclosures |
| compliance | GiftTracking | Gift/sample tracking |
| compliance | PharmaAuditLog | Audit trail |
| reference | PractitionersSync | Synced practitioners |
| reference | DrugsSync | Synced drug catalog |