Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated occupation field for text support #809

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion care/facility/api/serializers/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@


class PatientMetaInfoSerializer(serializers.ModelSerializer):
occupation = ChoiceField(choices=PatientMetaInfo.OccupationChoices)

class Meta:
model = PatientMetaInfo
Expand Down
27 changes: 27 additions & 0 deletions care/facility/migrations/0296_auto_20220531_1748.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 2.2.11 on 2022-05-31 12:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('facility', '0295_merge_20220527_1430'),
]

operations = [
migrations.AlterModelOptions(
name='facilitycapacity',
options={'verbose_name_plural': 'Facility Capacities'},
),
migrations.AlterField(
model_name='asset',
name='asset_class',
field=models.IntegerField(blank=True, choices=[('ONVIF', 'onvif'), ('HL7MONITOR', 'hl7monitor')], default=None, null=True),
),
migrations.AlterField(
model_name='patientmetainfo',
name='occupation',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
24 changes: 12 additions & 12 deletions care/facility/models/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,18 +531,18 @@ def has_read_permission(request):


class PatientMetaInfo(models.Model):
class OccupationEnum(enum.Enum):
STUDENT = 1
MEDICAL_WORKER = 2
GOVT_EMPLOYEE = 3
PRIVATE_EMPLOYEE = 4
HOME_MAKER = 5
WORKING_ABROAD = 6
OTHERS = 7

OccupationChoices = [(item.value, item.name) for item in OccupationEnum]

occupation = models.IntegerField(choices=OccupationChoices)
# class OccupationEnum(enum.Enum):
# STUDENT = 1
# MEDICAL_WORKER = 2
# GOVT_EMPLOYEE = 3
# PRIVATE_EMPLOYEE = 4
# HOME_MAKER = 5
# WORKING_ABROAD = 6
# OTHERS = 7

# OccupationChoices = [(item.value, item.name) for item in OccupationEnum]

occupation = models.CharField(max_length=100, null=True, blank=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We loose all data with this change, ideally we would need a migration to port over all the data as well.

head_of_household = models.BooleanField()


Expand Down