-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'reorder-active-patients'
- Loading branch information
Showing
73 changed files
with
1,381 additions
and
1,175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"build_systems": | ||
[ | ||
], | ||
"folders": | ||
[ | ||
{ | ||
"path": "." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by Django 3.1.2 on 2020-12-04 00:38 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('workup', '0006_auto_20201114_1735'), | ||
('core', '0005_auto_20201114_1258'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='EncounterStatus', | ||
fields=[ | ||
('name', models.CharField(max_length=100, primary_key=True, serialize=False)), | ||
('is_active', models.BooleanField(default=False)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Encounter', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('order', models.PositiveIntegerField(db_index=True, default=0, editable=False)), | ||
('patient', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.patient')), | ||
('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.encounterstatus')), | ||
('clinic_day', models.DateField()), | ||
], | ||
options={ | ||
'ordering': ['order'], | ||
}, | ||
), | ||
migrations.RemoveField( | ||
model_name='historicalpatient', | ||
name='needs_workup', | ||
), | ||
migrations.RemoveField( | ||
model_name='patient', | ||
name='needs_workup', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Generated by Django 3.1.2 on 2020-12-07 17:40 | ||
|
||
from django.db import migrations | ||
from django.conf import settings | ||
|
||
def make_encounter(apps, schema_editor): | ||
Encounter = apps.get_model('core','Encounter') | ||
EncounterStatus = apps.get_model('core','EncounterStatus') | ||
|
||
default_inactive = EncounterStatus.objects.get_or_create( | ||
name=settings.OSLER_DEFAULT_INACTIVE_STATUS[0], | ||
is_active=settings.OSLER_DEFAULT_INACTIVE_STATUS[1])[0] | ||
|
||
Workup = apps.get_model('workup','Workup') | ||
for workup in Workup.objects.all(): | ||
workup.encounter = Encounter.objects.get_or_create( | ||
patient=workup.patient, | ||
clinic_day=workup.clinic_day.clinic_date, | ||
status=default_inactive)[0] | ||
workup.save() | ||
|
||
Lab = apps.get_model('labs','Lab') | ||
for lab in Lab.objects.all(): | ||
lab.encounter = Encounter.objects.get_or_create( | ||
patient=lab.patient, | ||
clinic_day=lab.lab_time, | ||
status=default_inactive)[0] | ||
lab.save() | ||
|
||
note_types = [('workup','BasicNote'), ('workup','AttestableBasicNote'), | ||
('inventory','DispenseHistory'),('vaccine','VaccineDose')] | ||
|
||
for app, model in note_types: | ||
notes = apps.get_model(app, model) | ||
for note in notes.objects.all(): | ||
note.encounter = Encounter.objects.get_or_create( | ||
patient=note.patient, | ||
clinic_day=note.written_datetime, | ||
status=default_inactive)[0] | ||
note.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0006_encounter_encounterstatus'), | ||
('workup', '0007_auto_20201203_1940'), | ||
('labs','0003_lab_encounter'), | ||
('inventory','0003_dispensehistory_encounter'), | ||
('vaccine','0002_vaccinedose_encounter') | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(make_encounter), | ||
] |
Oops, something went wrong.