Skip to content

Commit

Permalink
Merge pull request #322 from openhealthcare/313-change-models-to-exte…
Browse files Browse the repository at this point in the history
…nd-from-opal-core-models

changed demographics model, migration
  • Loading branch information
fredkingham committed Dec 12, 2017
2 parents 70cc90a + 81591f1 commit 7ff4236
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 22 deletions.
44 changes: 44 additions & 0 deletions elcid/migrations/0010_auto_20171211_1321.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('elcid', '0009_auto_20171107_2248'),
]

operations = [
migrations.AlterField(
model_name='demographics',
name='date_of_birth',
field=models.DateField(null=True, verbose_name=b'Date of Birth', blank=True),
),
migrations.AlterField(
model_name='demographics',
name='date_of_death',
field=models.DateField(null=True, verbose_name=b'Date of Death', blank=True),
),
migrations.AlterField(
model_name='demographics',
name='death_indicator',
field=models.BooleanField(default=False, help_text=b'This field will be True if the patient is deceased.'),
),
migrations.AlterField(
model_name='demographics',
name='gp_practice_code',
field=models.CharField(max_length=20, null=True, verbose_name=b'GP Practice Code', blank=True),
),
migrations.AlterField(
model_name='demographics',
name='hospital_number',
field=models.CharField(help_text=b'The unique identifier for this patient at the hospital.', max_length=255, blank=True),
),
migrations.AlterField(
model_name='demographics',
name='nhs_number',
field=models.CharField(max_length=255, null=True, verbose_name=b'NHS Number', blank=True),
),
]
23 changes: 1 addition & 22 deletions elcid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,10 @@ def get_for_lookup_list(model, values):
)


class Demographics(PatientSubrecord, ExternallySourcedModel):
class Demographics(omodels.Demographics, ExternallySourcedModel):
_is_singleton = True
_icon = 'fa fa-user'

hospital_number = models.CharField(max_length=255, blank=True)
nhs_number = models.CharField(max_length=255, blank=True, null=True)

surname = models.CharField(max_length=255, blank=True)
first_name = models.CharField(max_length=255, blank=True)
middle_name = models.CharField(max_length=255, blank=True, null=True)
title = ForeignKeyOrFreeText(omodels.Title)
date_of_birth = models.DateField(null=True, blank=True)
marital_status = ForeignKeyOrFreeText(omodels.MaritalStatus)
religion = models.CharField(max_length=255, blank=True, null=True)
date_of_death = models.DateField(null=True, blank=True)
post_code = models.CharField(max_length=20, blank=True, null=True)
gp_practice_code = models.CharField(max_length=20, blank=True, null=True)
birth_place = ForeignKeyOrFreeText(omodels.Destination)
ethnicity = ForeignKeyOrFreeText(omodels.Ethnicity)
death_indicator = models.BooleanField(default=False)

# not strictly correct, but it will be updated when opal core models
# are updated
sex = ForeignKeyOrFreeText(omodels.Gender)

def set_death_indicator(self, value, *args, **kwargs):
if not value:
return
Expand Down

0 comments on commit 7ff4236

Please sign in to comment.