Created
October 19, 2020 11:01
-
-
Save fredkingham/c85077fcb90126620fc4cad2fe7a3aac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Fp17ClinicalDataSetSerializer(TreatmentSerializer): | |
| model = models.Fp17ClinicalDataSet | |
| TREATMENT_MAPPINGS = OrderedDict( | |
| [ | |
| ("examination", t.EXAMINATION), | |
| ("scale_and_polish", t.SCALE_AND_POLISH), | |
| ("fluoride_varnish", t.FLUORIDE_VARNISH), | |
| ("fissure_sealants", t.FISSURE_SEALANTS), | |
| ("radiographs_taken", t.RADIOGRAPHS), | |
| ("endodontic_treatment", t.ENDODONTIC_TREATMENT), | |
| ( | |
| "permanent_fillings_and_sealant_restorations", | |
| t.PERMANENT_FILLINGS_AND_SEALANT_RESTORATIONS, | |
| ), | |
| ("extractions", t.EXTRACTION), | |
| ("crowns_provided", t.CROWN), | |
| ("upper_denture_acrylic", t.UPPER_DENTURE_ACRYLIC), | |
| ("lower_denture_acrylic", t.LOWER_DENTURE_ACRYLIC), | |
| ("upper_denture_metal", t.UPPER_DENTURE_METAL), | |
| ("lower_denture_metal", t.LOWER_DENTURE_METAL), | |
| ("veneers_applied", t.VENEERS_APPLIED), | |
| ("inlays", t.INLAYS), | |
| ("bridges_fitted", t.BRIDGES_FITTED), | |
| ( | |
| "referral_for_advanced_mandatory_services_band", | |
| t.REFERRAL_FOR_ADVANCED_MANDATORY_SERVICES, | |
| ), | |
| ("antibiotic_items_prescribed", t.ANTIBIOTIC_ITEMS), | |
| ("other_treatment", t.OTHER_TREATMENT), | |
| ("best_practice_prevention", t.BEST_PRACTICE_PREVENTION), | |
| ("decayed_teeth_permanent", t.DECAYED_PERMANENT), | |
| ("decayed_teeth_deciduous", t.DECAYED_DECIDUOUS), | |
| ("missing_teeth_permanent", t.MISSING_PERMANENT), | |
| ("missing_teeth_deciduous", t.MISSING_DECIDUOUS), | |
| ("filled_teeth_permanent", t.FILLED_PERMANENT), | |
| ("filled_teeth_deciduous", t.FILLED_TEETH_DECIDUOUS), | |
| ] | |
| ) | |
| def to_messages(self): | |
| treatments = super().to_messages() | |
| change_date = datetime.date(2020, 3, 23) | |
| incomplete_treatment = self.episode.fp17incompletetreatment_set.get() | |
| date_of_acceptance = incomplete_treatment.date_of_acceptance | |
| if date_of_acceptance and date_of_acceptance >= change_date: | |
| if self.model_instance.aerosol_generating_procedures: | |
| treatments.append( | |
| t.AEROSOL_GENERATING_PROCEDURE(self.model_instance.aerosol_generating_procedures) | |
| ) | |
| return treatments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment