HH/apps/simulator/migrations/0001_initial.py
ismail fd19216b0d
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m5s
track migrations in git, regenerate fresh initial migrations, add staging-test compose, fix .gitignore
2026-05-11 23:34:39 +03:00

46 lines
3.2 KiB
Python

# Generated by Django 6.0.1 on 2026-05-11 20:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='HISRequestLog',
fields=[
('request_id', models.AutoField(primary_key=True, serialize=False)),
('timestamp', models.DateTimeField(auto_now_add=True, db_index=True)),
('channel', models.CharField(choices=[('email', 'Email Simulator'), ('sms', 'SMS Simulator'), ('his_event', 'HIS Journey Event')], db_index=True, max_length=20)),
('payload', models.JSONField(default=dict, help_text='Full request payload')),
('status', models.CharField(db_index=True, help_text='Request status: success, failed, partial, sent', max_length=20)),
('response_data', models.JSONField(blank=True, default=dict, help_text='Full response from simulator', null=True)),
('processing_time_ms', models.IntegerField(blank=True, help_text='Processing time in milliseconds', null=True)),
('error_message', models.TextField(blank=True, help_text='Error message if request failed', null=True)),
('patient_id', models.CharField(blank=True, db_index=True, help_text='Patient MRN when applicable', max_length=100, null=True)),
('journey_id', models.CharField(blank=True, db_index=True, help_text='Journey encounter ID when applicable', max_length=100, null=True)),
('survey_id', models.CharField(blank=True, db_index=True, help_text='Survey ID when applicable', max_length=100, null=True)),
('hospital_code', models.CharField(blank=True, db_index=True, help_text='Hospital code when applicable', max_length=50, null=True)),
('recipient', models.CharField(blank=True, help_text='Email address or phone number', max_length=255, null=True)),
('subject', models.CharField(blank=True, help_text='Email subject when applicable', max_length=500, null=True)),
('message_preview', models.TextField(blank=True, help_text='First 500 characters of message', null=True)),
('event_type', models.CharField(blank=True, db_index=True, help_text='HIS event type code', max_length=100, null=True)),
('visit_type', models.CharField(blank=True, db_index=True, help_text='Visit type: opd, inpatient, ems', max_length=50, null=True)),
('department', models.CharField(blank=True, help_text='Department name', max_length=100, null=True)),
('ip_address', models.GenericIPAddressField(blank=True, help_text='Client IP address', null=True)),
('user_agent', models.TextField(blank=True, help_text='Client user agent', null=True)),
],
options={
'verbose_name': 'HIS Request Log',
'verbose_name_plural': 'HIS Request Logs',
'ordering': ['-timestamp'],
'indexes': [models.Index(fields=['timestamp', 'channel'], name='simulator_h_timesta_af76d2_idx'), models.Index(fields=['status', 'timestamp'], name='simulator_h_status_354da9_idx')],
},
),
]