All checks were successful
Build and Push Docker Image / build (push) Successful in 1m5s
181 lines
16 KiB
Python
181 lines
16 KiB
Python
# Generated by Django 6.0.1 on 2026-05-11 20:32
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('organizations', '0001_initial'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='FeedbackAttachment',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('file', models.FileField(upload_to='feedback/%Y/%m/%d/')),
|
|
('filename', models.CharField(max_length=500)),
|
|
('file_type', models.CharField(blank=True, max_length=100)),
|
|
('file_size', models.IntegerField(help_text='File size in bytes')),
|
|
('description', models.TextField(blank=True)),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='FeedbackResponse',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('response_type', models.CharField(choices=[('status_change', 'Status Change'), ('assignment', 'Assignment'), ('note', 'Internal Note'), ('response', 'Response to Patient'), ('acknowledgment', 'Acknowledgment')], db_index=True, max_length=50)),
|
|
('message', models.TextField()),
|
|
('old_status', models.CharField(blank=True, max_length=20)),
|
|
('new_status', models.CharField(blank=True, max_length=20)),
|
|
('is_internal', models.BooleanField(default=False, help_text='Internal note (not visible to patient)')),
|
|
('metadata', models.JSONField(blank=True, default=dict)),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='PatientComment',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('serial_number', models.IntegerField(blank=True, help_text='Serial number from the source file', null=True)),
|
|
('source_category', models.CharField(blank=True, choices=[('appointment', 'Appointment'), ('inpatient', 'Inpatient'), ('outpatient', 'Outpatient')], db_index=True, help_text='Source category from IT export (Appointment/Inpatient/Outpatient)', max_length=20)),
|
|
('comment_text', models.TextField(help_text='Original comment text (Arabic/English)')),
|
|
('comment_text_en', models.TextField(blank=True, help_text='English translation of the comment')),
|
|
('classification', models.CharField(blank=True, choices=[('hospital', 'Hospital'), ('medical', 'Medical'), ('non_medical', 'Non-Medical'), ('nursing', 'Nursing'), ('er', 'Emergency'), ('support_services', 'Support Services')], db_index=True, help_text='Primary classification (Hospital/Medical/Non-Medical/Nursing/ER/Support)', max_length=20)),
|
|
('sub_category', models.CharField(blank=True, choices=[('pharmacy', 'Pharmacy'), ('rad', 'RAD'), ('lab', 'LAB'), ('physiotherapy', 'Physiotherapy'), ('doctors', 'Doctors'), ('medical_reports', 'Medical Reports'), ('reception', 'Reception'), ('insurance_approvals', 'Insurance/Approvals'), ('opd_clinics', 'OPD - Clinics'), ('appointments', 'Appointments'), ('it_app', 'IT - App'), ('administration', 'Administration'), ('billing', 'Billing'), ('facilities', 'Facilities'), ('food_services', 'Food Services'), ('parking', 'Parking'), ('housekeeping', 'Housekeeping'), ('other', 'Other')], db_index=True, help_text='Sub-category classification (e.g., Pharmacy, Reception, etc.)', max_length=30)),
|
|
('negative_keywords', models.TextField(blank=True, help_text='Negative sentiment keywords/phrases extracted')),
|
|
('positive_keywords', models.TextField(blank=True, help_text='Positive sentiment keywords/phrases extracted')),
|
|
('gratitude_keywords', models.TextField(blank=True, help_text='Gratitude keywords/phrases extracted')),
|
|
('suggestions', models.TextField(blank=True, help_text='Suggestion text extracted from the comment')),
|
|
('sentiment', models.CharField(blank=True, choices=[('positive', 'Positive'), ('neutral', 'Neutral'), ('negative', 'Negative')], db_index=True, help_text='Overall sentiment classification', max_length=20)),
|
|
('is_classified', models.BooleanField(db_index=True, default=False, help_text='Whether this comment has been classified')),
|
|
('mentioned_doctor_name', models.CharField(blank=True, help_text='Name of doctor mentioned in the comment', max_length=200)),
|
|
('mentioned_doctor_name_en', models.CharField(blank=True, help_text='English name of mentioned doctor', max_length=200)),
|
|
('frequency', models.IntegerField(default=1, help_text='How many times this comment/problem has been reported')),
|
|
('month', models.IntegerField(blank=True, help_text='Month the comment was collected', null=True)),
|
|
('year', models.IntegerField(blank=True, help_text='Year the comment was collected', null=True)),
|
|
('metadata', models.JSONField(blank=True, default=dict)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Patient Comment',
|
|
'verbose_name_plural': 'Patient Comments',
|
|
'ordering': ['-year', '-month', '-serial_number'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CommentActionPlan',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('department_label', models.CharField(blank=True, help_text='Free-text department name (for when no FK exists)', max_length=200)),
|
|
('problem_number', models.IntegerField(blank=True, help_text='Problem number within the department', null=True)),
|
|
('comment_text', models.TextField(blank=True, help_text='Related comment text')),
|
|
('comment_text_en', models.TextField(blank=True, help_text='English translation of the comment')),
|
|
('frequency', models.IntegerField(default=1, help_text='Number of times this problem was reported')),
|
|
('recommendation', models.TextField(help_text='Recommendation / Action Plan')),
|
|
('recommendation_en', models.TextField(blank=True, help_text='English translation of the recommendation')),
|
|
('responsible_department', models.CharField(blank=True, help_text='Free-text responsible department name', max_length=200)),
|
|
('status', models.CharField(choices=[('completed', 'Completed'), ('on_process', 'On Process'), ('pending', 'Pending')], db_index=True, default='pending', max_length=20)),
|
|
('timeframe', models.CharField(blank=True, help_text='Target timeframe (e.g., Q3, 3 months, 2025-Q1)', max_length=100)),
|
|
('evidences', models.TextField(blank=True, help_text='Evidence of completion / notes')),
|
|
('month', models.IntegerField(blank=True, null=True)),
|
|
('year', models.IntegerField(blank=True, null=True)),
|
|
('department', models.ForeignKey(blank=True, help_text='Responsible department', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='comment_action_plans', to='organizations.department')),
|
|
('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comment_action_plans', to='organizations.hospital')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Comment Action Plan',
|
|
'verbose_name_plural': 'Comment Action Plans',
|
|
'ordering': ['department_label', 'problem_number'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CommentImport',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('month', models.IntegerField(help_text='Month number (1-12)')),
|
|
('year', models.IntegerField(help_text='Year')),
|
|
('source_file', models.FileField(blank=True, help_text='Uploaded source file from IT department', upload_to='comments/imports/%Y/%m/')),
|
|
('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('completed', 'Completed'), ('failed', 'Failed')], default='pending', max_length=20)),
|
|
('total_rows', models.IntegerField(default=0, help_text='Total rows in the import file')),
|
|
('imported_count', models.IntegerField(default=0, help_text='Number of comments successfully imported')),
|
|
('error_count', models.IntegerField(default=0)),
|
|
('error_log', models.TextField(blank=True)),
|
|
('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comment_imports', to='organizations.hospital')),
|
|
('imported_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='comment_imports', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Comment Import',
|
|
'verbose_name_plural': 'Comment Imports',
|
|
'ordering': ['-year', '-month'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Feedback',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('is_deleted', models.BooleanField(db_index=True, default=False)),
|
|
('deleted_at', models.DateTimeField(blank=True, null=True)),
|
|
('is_anonymous', models.BooleanField(default=False)),
|
|
('contact_name', models.CharField(blank=True, max_length=200)),
|
|
('contact_email', models.EmailField(blank=True, max_length=254)),
|
|
('contact_phone', models.CharField(blank=True, max_length=20)),
|
|
('encounter_id', models.CharField(blank=True, db_index=True, help_text='Related encounter ID if applicable', max_length=100)),
|
|
('feedback_type', models.CharField(choices=[('compliment', 'Compliment'), ('suggestion', 'Suggestion'), ('general', 'General Feedback'), ('inquiry', 'Inquiry'), ('satisfaction_check', 'Satisfaction Check')], db_index=True, default='general', max_length=20)),
|
|
('title', models.CharField(max_length=500)),
|
|
('message', models.TextField(help_text='Feedback message')),
|
|
('category', models.CharField(choices=[('clinical_care', 'Clinical Care'), ('staff_service', 'Staff Service'), ('facility', 'Facility & Environment'), ('communication', 'Communication'), ('appointment', 'Appointment & Scheduling'), ('billing', 'Billing & Insurance'), ('food_service', 'Food Service'), ('cleanliness', 'Cleanliness'), ('technology', 'Technology & Systems'), ('other', 'Other')], db_index=True, max_length=50)),
|
|
('subcategory', models.CharField(blank=True, max_length=100)),
|
|
('rating', models.IntegerField(blank=True, help_text='Rating from 1 to 5 stars', null=True)),
|
|
('priority', models.CharField(choices=[('low', 'Low'), ('medium', 'Medium'), ('high', 'High'), ('critical', 'Critical')], db_index=True, default='medium', max_length=20)),
|
|
('sentiment', models.CharField(choices=[('positive', 'Positive'), ('neutral', 'Neutral'), ('negative', 'Negative')], db_index=True, default='neutral', help_text='Sentiment analysis result', max_length=20)),
|
|
('sentiment_score', models.FloatField(blank=True, help_text='Sentiment score from -1 (negative) to 1 (positive)', null=True)),
|
|
('status', models.CharField(choices=[('submitted', 'Submitted'), ('reviewed', 'Reviewed'), ('acknowledged', 'Acknowledged'), ('closed', 'Closed')], db_index=True, default='submitted', max_length=20)),
|
|
('assigned_at', models.DateTimeField(blank=True, null=True)),
|
|
('reviewed_at', models.DateTimeField(blank=True, null=True)),
|
|
('acknowledged_at', models.DateTimeField(blank=True, null=True)),
|
|
('closed_at', models.DateTimeField(blank=True, null=True)),
|
|
('is_featured', models.BooleanField(default=False, help_text='Feature this feedback (e.g., for testimonials)')),
|
|
('is_public', models.BooleanField(default=False, help_text='Make this feedback public')),
|
|
('requires_follow_up', models.BooleanField(default=False)),
|
|
('metadata', models.JSONField(blank=True, default=dict)),
|
|
('acknowledged_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='acknowledged_feedbacks', to=settings.AUTH_USER_MODEL)),
|
|
('assigned_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_feedbacks', to=settings.AUTH_USER_MODEL)),
|
|
('closed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='closed_feedbacks', to=settings.AUTH_USER_MODEL)),
|
|
('deleted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='deleted_%(class)s_set', to=settings.AUTH_USER_MODEL)),
|
|
('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedbacks', to='organizations.department')),
|
|
('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='feedbacks', to='organizations.hospital')),
|
|
('location', models.ForeignKey(blank=True, help_text='Location context', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedbacks', to='organizations.location')),
|
|
('main_section', models.ForeignKey(blank=True, help_text='Main section within the location', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='feedbacks', to='organizations.mainsection')),
|
|
('patient', models.ForeignKey(blank=True, help_text='Patient who provided feedback (optional for anonymous feedback)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='feedbacks', to='organizations.patient')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Feedback',
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
]
|