Skip to content

Commit

Permalink
Update local units health options
Browse files Browse the repository at this point in the history
  • Loading branch information
k9845 committed Apr 26, 2024
1 parent 203a16e commit 422465e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 17 additions & 1 deletion local_units/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@
HospitalType,
BloodService,
ProfessionalTrainingFacility,
GeneralMedicalService,
SpecializedMedicalService,
)
from api.models import Country
from main.writable_nested_serializers import NestedCreateMixin, NestedUpdateMixin


class GeneralMedicalServiceSerializer(serializers.ModelSerializer):
class Meta:
model = GeneralMedicalService
fields = "__all__"


class SpecializedMedicalServiceSerializer(serializers.ModelSerializer):
class Meta:
model = SpecializedMedicalService
fields = "__all__"


class AffiliationSerializer(serializers.ModelSerializer):
class Meta:
model = Affiliation
Expand Down Expand Up @@ -208,14 +222,16 @@ def get_type(self, office):

class LocalUnitOptionsSerializer(serializers.Serializer):
type = LocalUnitTypeSerializer(many=True)
coverage = LocalUnitLevelSerializer(many=True, source='level') # renaming level to coverage
level = LocalUnitLevelSerializer(many=True) # renaming level to coverage
affiliation = AffiliationSerializer(many=True)
functionality = FunctionalitySerializer(many=True)
health_facility_type = FacilityTypeSerializer(many=True)
primary_health_care_center = PrimaryHCCSerializer(many=True)
hospital_type = HospitalTypeSerializer(many=True)
blood_services = BloodServiceSerializer(many=True)
professional_training_facilities = ProfessionalTrainingFacilitySerializer(many=True)
general_medical_services = GeneralMedicalServiceSerializer(many=True)
specialized_medical_services = SpecializedMedicalServiceSerializer(many=True)


class MiniDelegationOfficeSerializer(serializers.ModelSerializer):
Expand Down
6 changes: 5 additions & 1 deletion local_units/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
HospitalType,
BloodService,
ProfessionalTrainingFacility,
VisibilityChoices
VisibilityChoices,
GeneralMedicalService,
SpecializedMedicalService,
)
from local_units.serializers import (
LocalUnitSerializer,
Expand Down Expand Up @@ -84,6 +86,8 @@ def get_options(self, request, pk=None):
hospital_type=HospitalType.objects.all(),
blood_services=BloodService.objects.all(),
professional_training_facilities=ProfessionalTrainingFacility.objects.all(),
general_medical_services=GeneralMedicalService.objects.all(),
specialized_medical_services=SpecializedMedicalService.objects.all(),
)
).data
)
Expand Down

0 comments on commit 422465e

Please sign in to comment.