def __init__(self, *args, **kwargs): super(OrganForm, self).__init__(*args, **kwargs) self.fields['donor'].widget = forms.HiddenInput() self.fields['location'].widget = forms.HiddenInput() self.fields['preservation'].widget = forms.HiddenInput() self.fields['removal'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'washout_perfusion'].choices = Organ.WASHOUT_PERFUSION_CHOICES self.fields['transplantable'].choices = YES_NO_CHOICES self.fields['perfusion_possible'].choices = YES_NO_CHOICES self.fields[ 'perfusion_started'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['patch_holder'].choices = Organ.PATCH_HOLDER_CHOICES self.fields['artificial_patch_used'].choices = NO_YES_CHOICES self.fields[ 'artificial_patch_size'].choices = Organ.ARTIFICIAL_PATCH_CHOICES self.fields['oxygen_bottle_full'].choices = NO_YES_CHOICES self.fields['oxygen_bottle_open'].choices = YES_NO_CHOICES self.fields['oxygen_bottle_changed'].choices = NO_YES_CHOICES self.fields[ 'oxygen_bottle_changed_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['ice_container_replenished'].choices = NO_YES_CHOICES self.fields[ 'ice_container_replenished_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['perfusate_measurable'].choices = NO_YES_CHOICES self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( Div(FormPanel( "Inspection", Layout( FieldWithFollowup( Field('transplantable', template= "bootstrap3/layout/radioselect-buttons.html"), 'not_transplantable_reason'), DateTimeField('removal'), 'renal_arteries', FieldWithFollowup('graft_damage', 'graft_damage_other'), Field('washout_perfusion', template="bootstrap3/layout/radioselect-buttons.html" ))), FormPanel( "Preset Data", Layout( 'donor', Field('location', template="bootstrap3/layout/read-only.html"), Field('preservation', template="bootstrap3/layout/read-only.html"))), css_class="col-md-4", style="margin-top: 10px;"), Div(FormPanel("Perfusion Data", self.layout_perfusion), css_class="col-md-4", style="margin-top: 10px;"))
def __init__(self, *args, **kwargs): super(AllocationStartForm, self).__init__(*args, **kwargs) self.fields['allocated'].choices = YES_NO_CHOICES self.helper = FormHelper() self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( 'organ', FieldWithFollowup( Field('allocated', template="bootstrap3/layout/radioselect-buttons.html"), 'not_allocated_reason'))
def __init__(self, *args, **kwargs): super(DonorStartForm, self).__init__(*args, **kwargs) self.fields['gender'].label = Patient._meta.get_field( "gender").verbose_name.title() self.fields['gender'].choices = Patient.GENDER_CHOICES self.fields['online'].required = False self.fields['online'].choices = YES_NO_CHOICES self.helper = FormHelper() self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( 'retrieval_team', 'perfusion_technician', 'age', Field('gender', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( Field('online', template="bootstrap3/layout/radioselect-buttons.html"), 'randomisation'))
def __init__(self, *args, **kwargs): super(TransplantOrganForm, self).__init__(*args, **kwargs) self.fields['transplantation_form_completed'].choices = NO_YES_CHOICES self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( FormPanel("Complete Submission", Layout( 'transplantation_notes', FieldWithFollowup( Field('transplantation_form_completed', template="bootstrap3/layout/radioselect-buttons.html"), HTML( "<p class=\"text-danger\">Once all errors have been cleared, clicking Save below will " + "result in this form being closed and locked. No further edits will be possible " + "without contacting the admin team.</p>" ) ) ), panel_status="danger"), # , panel_hidden=True )
class OrganForm(forms.ModelForm): layout_artificial_patches = Layout( Field('artificial_patch_size', template="bootstrap3/layout/radioselect-buttons.html"), 'artificial_patch_number') layout_perfusion_possible = Layout( 'perfusion_machine', DateTimeField('perfusion_started'), Field('patch_holder', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( Field('artificial_patch_used', template="bootstrap3/layout/radioselect-buttons.html"), layout_artificial_patches), Field('oxygen_bottle_full', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( Field('oxygen_bottle_open', template="bootstrap3/layout/radioselect-buttons.html"), HTML( "<p class=\"text-warning\"><i class=\"glyphicon glyphicon-warning-sign\"></i> The " + "bottle should be open!</p>")), FieldWithFollowup( Field('oxygen_bottle_changed', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithNotKnown( DateTimeField('oxygen_bottle_changed_at', notknown=True), 'oxygen_bottle_changed_at_unknown', label=Organ._meta.get_field( "oxygen_bottle_changed_at").verbose_name.title()), ), FieldWithFollowup( Field('ice_container_replenished', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithNotKnown( DateTimeField('ice_container_replenished_at', notknown=True), 'ice_container_replenished_at_unknown', label=Organ._meta.get_field( "ice_container_replenished_at").verbose_name.title()), ), FieldWithFollowup( Field('perfusate_measurable', template="bootstrap3/layout/radioselect-buttons.html"), 'perfusate_measure')) layout_perfusion_not_possible = Layout( 'perfusion_not_possible_because', HTML( "<p class=\"text-warning\"><i class=\"glyphicon glyphicon-warning-sign\"></i> Please " + "remember to enter resources used</p>")) layout_perfusion = Layout( YesNoFieldWithAlternativeFollowups('perfusion_possible', layout_perfusion_not_possible, layout_perfusion_possible)) def __init__(self, *args, **kwargs): super(OrganForm, self).__init__(*args, **kwargs) self.fields['donor'].widget = forms.HiddenInput() self.fields['location'].widget = forms.HiddenInput() self.fields['preservation'].widget = forms.HiddenInput() self.fields['removal'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'washout_perfusion'].choices = Organ.WASHOUT_PERFUSION_CHOICES self.fields['transplantable'].choices = YES_NO_CHOICES self.fields['perfusion_possible'].choices = YES_NO_CHOICES self.fields[ 'perfusion_started'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['patch_holder'].choices = Organ.PATCH_HOLDER_CHOICES self.fields['artificial_patch_used'].choices = NO_YES_CHOICES self.fields[ 'artificial_patch_size'].choices = Organ.ARTIFICIAL_PATCH_CHOICES self.fields['oxygen_bottle_full'].choices = NO_YES_CHOICES self.fields['oxygen_bottle_open'].choices = YES_NO_CHOICES self.fields['oxygen_bottle_changed'].choices = NO_YES_CHOICES self.fields[ 'oxygen_bottle_changed_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['ice_container_replenished'].choices = NO_YES_CHOICES self.fields[ 'ice_container_replenished_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['perfusate_measurable'].choices = NO_YES_CHOICES self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( Div(FormPanel( "Inspection", Layout( FieldWithFollowup( Field('transplantable', template= "bootstrap3/layout/radioselect-buttons.html"), 'not_transplantable_reason'), DateTimeField('removal'), 'renal_arteries', FieldWithFollowup('graft_damage', 'graft_damage_other'), Field('washout_perfusion', template="bootstrap3/layout/radioselect-buttons.html" ))), FormPanel( "Preset Data", Layout( 'donor', Field('location', template="bootstrap3/layout/read-only.html"), Field('preservation', template="bootstrap3/layout/read-only.html"))), css_class="col-md-4", style="margin-top: 10px;"), Div(FormPanel("Perfusion Data", self.layout_perfusion), css_class="col-md-4", style="margin-top: 10px;")) class Meta: model = Organ fields = [ 'donor', 'location', 'removal', 'renal_arteries', 'graft_damage', 'graft_damage_other', 'washout_perfusion', 'transplantable', 'not_transplantable_reason', 'preservation', 'perfusion_possible', 'perfusion_not_possible_because', 'perfusion_started', 'patch_holder', 'artificial_patch_used', 'artificial_patch_size', 'artificial_patch_number', 'oxygen_bottle_full', 'oxygen_bottle_open', 'oxygen_bottle_changed', 'oxygen_bottle_changed_at', 'oxygen_bottle_changed_at_unknown', 'ice_container_replenished', 'ice_container_replenished_at', 'ice_container_replenished_at_unknown', 'perfusate_measurable', 'perfusate_measure', 'perfusion_machine' ] localized_fields = "__all__"
def __init__(self, *args, **kwargs): super(DonorForm, self).__init__(*args, **kwargs) self.fields['person'].widget = forms.HiddenInput() self.fields['retrieval_team'].widget = forms.HiddenInput() self.fields['sequence_number'].widget = forms.HiddenInput() self.fields['perfusion_technician'].widget = forms.HiddenInput() self.fields[ 'call_received'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'scheduled_start'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'technician_arrival'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'ice_boxes_filled'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'depart_perfusion_centre'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'arrival_at_donor_hospital'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['multiple_recipients'].choices = YES_NO_UNKNOWN_CHOICES self.fields[ 'date_of_admission'].input_formats = settings.DATE_INPUT_FORMATS self.fields['admitted_to_itu'].choices = NO_YES_CHOICES self.fields[ 'date_admitted_to_itu'].input_formats = settings.DATE_INPUT_FORMATS self.fields[ 'date_of_procurement'].input_formats = settings.DATE_INPUT_FORMATS self.fields['other_organs_procured'].choices = NO_YES_CHOICES self.fields['other_organs_lungs'].choices = NO_YES_CHOICES self.fields['other_organs_pancreas'].choices = NO_YES_CHOICES self.fields['other_organs_liver'].choices = NO_YES_CHOICES self.fields['other_organs_tissue'].choices = NO_YES_CHOICES self.fields['diabetes_melitus'].choices = YES_NO_UNKNOWN_CHOICES self.fields['alcohol_abuse'].choices = YES_NO_UNKNOWN_CHOICES self.fields['hypertension'].choices = YES_NO_UNKNOWN_CHOICES self.fields['cardiac_arrest'].choices = NO_YES_CHOICES self.fields['dopamine'].choices = YES_NO_UNKNOWN_CHOICES self.fields['dobutamine'].choices = YES_NO_UNKNOWN_CHOICES self.fields['nor_adrenaline'].choices = YES_NO_UNKNOWN_CHOICES self.fields['vasopressine'].choices = YES_NO_UNKNOWN_CHOICES self.fields[ 'life_support_withdrawal'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'systolic_pressure_low'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'o2_saturation'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'circulatory_arrest'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'death_diagnosed'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields[ 'perfusion_started'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['systemic_flush_used'].choices = Donor.SOLUTION_CHOICES self.fields['heparin'].choices = NO_YES_CHOICES self.fields['procurement_form_completed'].choices = NO_YES_CHOICES if self.instance.is_randomised: # Hide these questions if randomised self.fields['not_randomised_because'].widget = forms.HiddenInput() self.fields[ 'not_randomised_because_other'].widget = forms.HiddenInput() else: # Cut out the Not Applicable option (1st element) self.fields[ 'not_randomised_because'].choices = Donor.NON_RANDOMISATION_CHOICES[ 1:] self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( FormPanel( "Donor Details", Layout( 'age', FieldWithNotKnown( DateField('date_of_admission', notknown=True), 'date_of_admission_unknown', label=Donor._meta.get_field( "date_of_admission").verbose_name.title()), FieldWithFollowup( Field('admitted_to_itu', template= "bootstrap3/layout/radioselect-buttons.html"), FieldWithNotKnown( DateField('date_admitted_to_itu', notknown=True), 'date_admitted_to_itu_unknown', label=Donor._meta.get_field( "date_admitted_to_itu").verbose_name.title()), ), DateField('date_of_procurement'), FieldWithFollowup( Field('other_organs_procured', template= "bootstrap3/layout/radioselect-buttons.html"), Layout( Field( 'other_organs_lungs', template= "bootstrap3/layout/radioselect-buttons.html"), Field( 'other_organs_pancreas', template= "bootstrap3/layout/radioselect-buttons.html"), Field( 'other_organs_liver', template= "bootstrap3/layout/radioselect-buttons.html"), Field('other_organs_tissue', template= "bootstrap3/layout/radioselect-buttons.html") )))), HTML("</div>"), Div(FormPanel( "Procedure Data", Layout( Field('retrieval_team', template="bootstrap3/layout/read-only.html"), 'sequence_number', Field('perfusion_technician', template="bootstrap3/layout/read-only.html"), ForeignKeyModal('transplant_coordinator'), FieldWithNotKnown( DateTimeField('call_received', notknown=True), 'call_received_unknown', label=Donor._meta.get_field( "call_received").verbose_name.title()), 'retrieval_hospital', FieldWithNotKnown( DateTimeField('scheduled_start', notknown=True), 'scheduled_start_unknown', label=Donor._meta.get_field( "scheduled_start").verbose_name.title()), FieldWithNotKnown( DateTimeField('technician_arrival', notknown=True), 'technician_arrival_unknown', label=Donor._meta.get_field( "technician_arrival").verbose_name.title()), FieldWithNotKnown( DateTimeField('ice_boxes_filled', notknown=True), 'ice_boxes_filled_unknown', label=Donor._meta.get_field( "ice_boxes_filled").verbose_name.title()), FieldWithNotKnown( DateTimeField('depart_perfusion_centre', notknown=True), 'depart_perfusion_centre_unknown', label=Donor._meta.get_field( "depart_perfusion_centre").verbose_name.title()), FieldWithNotKnown( DateTimeField('arrival_at_donor_hospital', notknown=True), 'arrival_at_donor_hospital_unknown', label=Donor._meta.get_field( "arrival_at_donor_hospital").verbose_name.title()), Field('multiple_recipients', template="bootstrap3/layout/radioselect-buttons.html" ))), FormPanel( "Donor Procedure", Layout( DateTimeField('life_support_withdrawal'), FieldWithNotKnown( DateTimeField('systolic_pressure_low', notknown=True), 'systolic_pressure_low_unknown', label=Donor._meta.get_field( "systolic_pressure_low").verbose_name.title()), FieldWithNotKnown( DateTimeField('o2_saturation', notknown=True), 'o2_saturation_unknown', label=Donor._meta.get_field( "o2_saturation").verbose_name.title()), FieldWithNotKnown( DateTimeField('circulatory_arrest', notknown=True), 'circulatory_arrest_unknown', label=Donor._meta.get_field( "circulatory_arrest").verbose_name.title()), 'length_of_no_touch', DateTimeField('death_diagnosed'), FieldWithNotKnown( DateTimeField('perfusion_started', notknown=True), 'perfusion_started_unknown', label=Donor._meta.get_field( "perfusion_started").verbose_name.title()), FieldWithFollowup( Field( 'systemic_flush_used', template= "bootstrap3/layout/radioselect-buttons.html"), 'systemic_flush_used_other'), 'systemic_flush_volume_used', Field('heparin', template= "bootstrap3/layout/radioselect-buttons.html"))), css_class="col-md-4", style="margin-top: 10px;"), Div(FormPanel( "Donor Preop Data", Layout( FieldWithFollowup('diagnosis', 'diagnosis_other'), Field( 'diabetes_melitus', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'alcohol_abuse', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'hypertension', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'cardiac_arrest', template="bootstrap3/layout/radioselect-buttons.html"), 'systolic_blood_pressure', 'diastolic_blood_pressure', FieldWithNotKnown('diuresis_last_day', 'diuresis_last_day_unknown'), FieldWithNotKnown('diuresis_last_hour', 'diuresis_last_hour_unknown'), Field( 'dopamine', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'dobutamine', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'nor_adrenaline', template="bootstrap3/layout/radioselect-buttons.html"), Field( 'vasopressine', template="bootstrap3/layout/radioselect-buttons.html"), 'other_medication_details')), FormPanel( "Lab Results", Layout( InlineFields('last_creatinine', 'last_creatinine_unit'), InlineFields('max_creatinine', 'max_creatinine_unit'), )), FormPanel( "Complete Submission", Layout( FieldWithFollowup( Field( 'procurement_form_completed', template= "bootstrap3/layout/radioselect-buttons.html"), self.layout_almost_complete)), panel_status="danger"), css_class="col-md-4", style="margin-top: 10px;"), 'person', )
def __init__(self, *args, **kwargs): super(AllocationForm, self).__init__(*args, **kwargs) self.fields['organ'].widget = forms.HiddenInput() self.fields['perfusion_technician'].required = False self.fields['call_received'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['scheduled_start'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['technician_arrival'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['depart_perfusion_centre'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['arrival_at_recipient_hospital'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['reallocated'].choices = NO_YES_CHOICES self.fields['reallocation_reason'].choices = OrganAllocation.REALLOCATION_CHOICES self.fields['reallocation'].widget = forms.HiddenInput() self.helper = FormHelper() self.helper.form_tag = False self.helper.html5_required = True self.helper.include_media = False # We will add the media ourselves in the footer self.helper.layout = Layout( 'organ', Div( Div( 'perfusion_technician', FieldWithNotKnown( DateTimeField('call_received', notknown=True), 'call_received_unknown', label=OrganAllocation._meta.get_field("call_received").verbose_name.title() ), 'transplant_hospital', ForeignKeyModal('theatre_contact'), FieldWithNotKnown( DateTimeField('scheduled_start', notknown=True), 'scheduled_start_unknown', label=OrganAllocation._meta.get_field("scheduled_start").verbose_name.title() ), FieldWithNotKnown( DateTimeField('technician_arrival', notknown=True), 'technician_arrival_unknown', label=OrganAllocation._meta.get_field("technician_arrival").verbose_name.title() ), style="padding-right:0.5em" ), css_class="col-md-4" ), Div( Div( FieldWithNotKnown( DateTimeField('depart_perfusion_centre', notknown=True), 'depart_perfusion_centre_unknown', label=OrganAllocation._meta.get_field("depart_perfusion_centre").verbose_name.title() ), FieldWithNotKnown( DateTimeField('arrival_at_recipient_hospital', notknown=True), 'arrival_at_recipient_hospital_unknown', label=OrganAllocation._meta.get_field("arrival_at_recipient_hospital").verbose_name.title() ), 'journey_remarks', style="padding-right:0.5em" ), css_class="col-md-4" ), Div( FieldWithFollowup( Field('reallocated', template="bootstrap3/layout/radioselect-buttons.html"), self.layout_reallocation ), css_class="col-md-4" ) )
def __init__(self, *args, **kwargs): super(RecipientForm, self).__init__(*args, **kwargs) self.fields['person'].widget = forms.HiddenInput() self.fields['organ'].widget = forms.HiddenInput() self.fields['allocation'].widget = forms.HiddenInput() self.fields['signed_consent'].choices = NO_YES_CHOICES self.fields['single_kidney_transplant'].choices = NO_YES_CHOICES self.fields['renal_disease'].choices = Recipient.RENAL_DISEASE_CHOICES self.fields['knife_to_skin'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['perfusion_stopped'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['organ_cold_stored'].choices = NO_YES_CHOICES self.fields['tape_broken'].choices = YES_NO_UNKNOWN_CHOICES self.fields['removed_from_machine_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['oxygen_full_and_open'].choices = YES_NO_UNKNOWN_CHOICES self.fields['organ_untransplantable'].choices = NO_YES_CHOICES self.fields['anesthesia_started_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['incision'].choices = Recipient.INCISION_CHOICES self.fields['transplant_side'].choices = LOCATION_CHOICES self.fields['transplant_side'].required = False self.fields['arterial_problems'].choices = Recipient.ARTERIAL_PROBLEM_CHOICES self.fields['venous_problems'].choices = Recipient.VENOUS_PROBLEM_CHOICES self.fields['anastomosis_started_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['reperfusion_started_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['mannitol_used'].choices = YES_NO_UNKNOWN_CHOICES self.fields['other_diurectics'].choices = YES_NO_UNKNOWN_CHOICES self.fields['intra_operative_diuresis'].choices = YES_NO_UNKNOWN_CHOICES self.fields['successful_conclusion'].choices = NO_YES_CHOICES self.fields['operation_concluded_at'].input_formats = settings.DATETIME_INPUT_FORMATS self.fields['probe_cleaned'].choices = NO_YES_CHOICES self.fields['ice_removed'].choices = NO_YES_CHOICES self.fields['oxygen_flow_stopped'].choices = NO_YES_CHOICES self.fields['oxygen_bottle_removed'].choices = NO_YES_CHOICES self.fields['box_cleaned'].choices = NO_YES_CHOICES self.fields['batteries_charged'].choices = NO_YES_CHOICES self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( FormPanel("Recipient Details", Layout( Field('single_kidney_transplant', template="bootstrap3/layout/radioselect-buttons.html"), Field('signed_consent', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( 'renal_disease', 'renal_disease_other' ), 'pre_transplant_diuresis', FieldWithNotKnown('panel_reactive_antibodies', 'panel_reactive_antibodies_unknown'), )), HTML("</div>"), Div( FormPanel("Peri-Operative Data", Layout( 'perfusate_measure', DateTimeField('perfusion_stopped'), Field('organ_cold_stored', template="bootstrap3/layout/radioselect-buttons.html"), Field('tape_broken', template="bootstrap3/layout/radioselect-buttons.html"), # 'tape_broken', DateTimeField('removed_from_machine_at'), Field('oxygen_full_and_open', template="bootstrap3/layout/radioselect-buttons.html"), YesNoFieldWithAlternativeFollowups( Field('organ_untransplantable', template="bootstrap3/layout/radioselect-buttons.html"), 'organ_untransplantable_reason', Layout( DateTimeField('anesthesia_started_at'), DateTimeField('knife_to_skin'), Field('incision', template="bootstrap3/layout/radioselect-buttons.html"), Field('transplant_side', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( 'arterial_problems', 'arterial_problems_other' ), FieldWithFollowup( 'venous_problems', 'venous_problems_other' ), FieldWithNotKnown( DateTimeField('anastomosis_started_at', notknown=True), 'anastomosis_started_at_unknown', label=Recipient._meta.get_field("anastomosis_started_at").verbose_name.title() ), FieldWithNotKnown( DateTimeField('reperfusion_started_at', notknown=True), 'reperfusion_started_at_unknown', label=Recipient._meta.get_field("reperfusion_started_at").verbose_name.title() ), Field('mannitol_used', template="bootstrap3/layout/radioselect-buttons.html"), FieldWithFollowup( Field('other_diurectics', template="bootstrap3/layout/radioselect-buttons.html"), 'other_diurectics_details' ), 'systolic_blood_pressure', 'cvp', Field('intra_operative_diuresis', template="bootstrap3/layout/radioselect-buttons.html"), Field('successful_conclusion', template="bootstrap3/layout/radioselect-buttons.html"), DateTimeField('operation_concluded_at') ) ) )), css_class="col-md-4", style="margin-top: 10px;" ), Div( FormPanel("Cleaning Log", Layout( Field('probe_cleaned', template="bootstrap3/layout/radioselect-buttons.html"), Field('ice_removed', template="bootstrap3/layout/radioselect-buttons.html"), Field('oxygen_flow_stopped', template="bootstrap3/layout/radioselect-buttons.html"), Field('oxygen_bottle_removed', template="bootstrap3/layout/radioselect-buttons.html"), Field('box_cleaned', template="bootstrap3/layout/radioselect-buttons.html"), Field('batteries_charged', template="bootstrap3/layout/radioselect-buttons.html"), 'cleaning_log' )), css_class="col-md-4", style="margin-top: 10px;" ), 'person', 'organ', 'allocation' )
def __init__(self, *args, **kwargs): super(FollowUp1YForm, self).__init__(*args, **kwargs) self.fields['organ'].widget = forms.HiddenInput() self.fields['organ'].choices = Organ.objects.filter(id=self.instance.organ.id).values_list('id', 'trial_id') self.fields['start_date'].input_formats = settings.DATE_INPUT_FORMATS # FB01 self.fields['graft_failure_date'].input_formats = settings.DATE_INPUT_FORMATS # FB11 self.fields['graft_removal_date'].input_formats = settings.DATE_INPUT_FORMATS # FB15 self.fields['dialysis_date'].input_formats = settings.DATE_INPUT_FORMATS # FY04 self.fields['currently_on_dialysis'].choices = YES_NO_UNKNOWN_CHOICES # FY03 self.fields['graft_failure'].choices = NO_YES_CHOICES # FB10 self.fields['graft_removal'].choices = NO_YES_CHOICES # FB14 self.fields['rejection'].choices = NO_YES_CHOICES # FB19 self.fields['rejection_prednisolone'].choices = NO_YES_CHOICES # FB20 self.fields['rejection_drug'].choices = NO_YES_CHOICES # FB21 self.fields['rejection_biopsy'].choices = NO_YES_CHOICES # FB23 self.fields['calcineurin'].choices = NO_YES_CHOICES # FB24 self.fields['serum_creatinine_unit'].choices = FollowUpBase.UNIT_CHOICES # FY10 self.fields['dialysis_type'].choices = FollowUpInitial.DIALYSIS_TYPE_CHOICES # FB16 self.fields['graft_complications'].widget = forms.Textarea() # FY07 self.fields['notes'].widget = forms.Textarea() # FB03 self.fields['quality_of_life'].choices = QualityOfLife.objects.\ filter(id=self.instance.quality_of_life.id).values_list('id', 'recipient__organ__trial_id') self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( Div( Div( Field('organ', template="bootstrap3/layout/read-only.html"), # FI01 FieldWithFollowup( Field('graft_failure', template="bootstrap3/layout/radioselect-buttons.html"), # FB10 Layout( DateField('graft_failure_date'), # FB11 'graft_failure_type', # FB12 'graft_failure_type_other', # FB13 ) ), css_class="col-md-6" ), Div( DateField('start_date'), # FB01 FieldWithFollowup( Field('graft_removal', template="bootstrap3/layout/radioselect-buttons.html"), # FB14 DateField('graft_removal_date'), # FB15 ), css_class="col-md-6" ), css_class="row" ), Div( Div( Field('serum_creatinine_unit', template="bootstrap3/layout/radioselect-buttons.html"), # FY10 'serum_creatinine', # FY11 'creatinine_clearance', # FY02 css_class="col-md-4" ), Div( FieldWithFollowup( Field('currently_on_dialysis', template="bootstrap3/layout/radioselect-buttons.html"), # FY03 Field('dialysis_type', template="bootstrap3/layout/radioselect-buttons.html"), # FB16 ), css_class="col-md-4" ), Div( DateField('dialysis_date'), # FY04 'number_of_dialysis_sessions', # FY05 css_class="col-md-4" ), css_class="row" ), Div( Div( HTML("<h4>Post Tx Immunosuppresion</h4>"), 'immunosuppression_1', # FB30 'immunosuppression_2', # FB31 'immunosuppression_3', # FB32 'immunosuppression_4', # FB33 'immunosuppression_5', # FB34 'immunosuppression_6', # FB35 'immunosuppression_7', # FB36 'immunosuppression_other', # FB37 css_class="col-md-4" ), Div( FieldWithFollowup( Field('rejection', template="bootstrap3/layout/radioselect-buttons.html"), # FB19 Layout( 'rejection_periods', # FY06 Field('rejection_prednisolone', template="bootstrap3/layout/radioselect-buttons.html"), # FB20 Field('rejection_drug', template="bootstrap3/layout/radioselect-buttons.html"), # FB21 'rejection_drug_other', # FB22 Field('rejection_biopsy', template="bootstrap3/layout/radioselect-buttons.html"), # FB23 ) ), css_class="col-md-4" ), Div( Field('calcineurin', template="bootstrap3/layout/radioselect-buttons.html"), # FB24 'graft_complications', # FY07 'notes', # FB03 css_class="col-md-4" ), css_class="row" ), ForeignKeyModal('quality_of_life', no_search=True), # FY08 )
def __init__(self, *args, **kwargs): super(FollowUpInitialForm, self).__init__(*args, **kwargs) self.fields['start_date'].input_formats = settings.DATE_INPUT_FORMATS self.fields['graft_failure_date'].input_formats = settings.DATE_INPUT_FORMATS self.fields['graft_removal_date'].input_formats = settings.DATE_INPUT_FORMATS self.fields['discharge_date'].input_formats = settings.DATE_INPUT_FORMATS self.fields['graft_failure'].choices = NO_YES_CHOICES self.fields['graft_removal'].choices = NO_YES_CHOICES self.fields['rejection'].choices = NO_YES_CHOICES self.fields['rejection_prednisolone'].choices = NO_YES_CHOICES self.fields['rejection_drug'].choices = NO_YES_CHOICES self.fields['rejection_biopsy'].choices = NO_YES_CHOICES self.fields['calcineurin'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_1'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_2'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_3'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_4'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_5'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_6'].choices = NO_YES_CHOICES self.fields['dialysis_requirement_7'].choices = NO_YES_CHOICES self.fields['serum_creatinine_unit'].choices = FollowUpBase.UNIT_CHOICES self.fields['dialysis_type'].choices = FollowUpInitial.DIALYSIS_TYPE_CHOICES self.fields['induction_therapy'].choices = FollowUpInitial.INDUCTION_CHOICES self.fields['organ'].widget = forms.HiddenInput() self.fields['organ'].choices = Organ.objects.filter(id=self.instance.organ.id).values_list('id', 'trial_id') self.fields['notes'].widget = forms.Textarea() self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( Div( Div( Field('organ', template="bootstrap3/layout/read-only.html"), # FI01 FieldWithFollowup( Field('graft_failure', template="bootstrap3/layout/radioselect-buttons.html"), # FB10 Layout( DateField('graft_failure_date'), # FB11 'graft_failure_type', # FB12 'graft_failure_type_other', # FB13 ) ), css_class="col-md-6" ), Div( DateField('start_date'), # FB01 FieldWithFollowup( Field('graft_removal', template="bootstrap3/layout/radioselect-buttons.html"), # FB14 DateField('graft_removal_date'), # FB15 ), css_class="col-md-6" ), css_class="row" ), Div( Div( Field('serum_creatinine_unit', template="bootstrap3/layout/radioselect-buttons.html"), # FI02 'serum_creatinine_1', # FI03 css_class="col-md-3" ), Div( 'serum_creatinine_2', # FI04 'serum_creatinine_3', # FI05 css_class="col-md-3" ), Div( 'serum_creatinine_4', # FI06 'serum_creatinine_5', # FI07 css_class="col-md-3" ), Div( 'serum_creatinine_6', # FI08 'serum_creatinine_7', # FI09 css_class="col-md-3" ), css_class="row" ), Div( Div( Field('dialysis_requirement_1', template="bootstrap3/layout/radioselect-buttons.html"), # FI10 Field('dialysis_requirement_2', template="bootstrap3/layout/radioselect-buttons.html"), # FI11 css_class="col-md-3" ), Div( Field('dialysis_requirement_3', template="bootstrap3/layout/radioselect-buttons.html"), # FI12 Field('dialysis_requirement_4', template="bootstrap3/layout/radioselect-buttons.html"), # FI13 css_class="col-md-3" ), Div( Field('dialysis_requirement_5', template="bootstrap3/layout/radioselect-buttons.html"), # FI14 Field('dialysis_requirement_6', template="bootstrap3/layout/radioselect-buttons.html"), # FI15 css_class="col-md-3" ), Div( Field('dialysis_requirement_7', template="bootstrap3/layout/radioselect-buttons.html"), # FI16 Field('dialysis_type', template="bootstrap3/layout/radioselect-buttons.html"), # FB16 css_class="col-md-3" ), css_class="row" ), Div( Div( 'dialysis_cause', # FI20 'dialysis_cause_other', # FI21 'hla_mismatch_a', # FI22 'hla_mismatch_b', # FI23 'hla_mismatch_dr', # FI24 css_class="col-md-4" ), Div( Field('induction_therapy', template="bootstrap3/layout/radioselect-buttons.html"), # FI25 HTML("<h4>Post Tx Immunosuppresion</h4>"), 'immunosuppression_1', # FB30 'immunosuppression_2', # FB31 'immunosuppression_3', # FB32 'immunosuppression_4', # FB33 'immunosuppression_5', # FB34 'immunosuppression_6', # FB35 'immunosuppression_7', # FB36 'immunosuppression_other', # FB37 css_class="col-md-4" ), Div( FieldWithFollowup( Field('rejection', template="bootstrap3/layout/radioselect-buttons.html"), # FB19 Layout( Field('rejection_prednisolone', template="bootstrap3/layout/radioselect-buttons.html"), # FB20 Field('rejection_drug', template="bootstrap3/layout/radioselect-buttons.html"), # FB21 'rejection_drug_other', # FB22 Field('rejection_biopsy', template="bootstrap3/layout/radioselect-buttons.html"), # FB23 ) ), css_class="col-md-4" ), css_class="row" ), Field('calcineurin', template="bootstrap3/layout/radioselect-buttons.html"), # FB24 DateField('discharge_date'), # FI26 'notes', # FB03 )
def __init__(self, *args, **kwargs): super(EventForm, self).__init__(*args, **kwargs) # self.fields['organ'].widget = forms.HiddenInput() # A redundant shortcut now that DAL 3.2.4 has implemented something to do similar that expects a queryset # self.fields['organ'].choices = Event.objects.select_related('organ').\ # filter(id=self.instance.id).values_list('id', 'organ__trial_id') self.fields['serious_eligible_1'].choices = NO_YES_CHOICES self.fields['serious_eligible_2'].choices = NO_YES_CHOICES self.fields['serious_eligible_3'].choices = NO_YES_CHOICES self.fields['serious_eligible_4'].choices = NO_YES_CHOICES self.fields['serious_eligible_5'].choices = NO_YES_CHOICES self.fields['serious_eligible_6'].choices = NO_YES_CHOICES self.fields['onset_at_date'].input_formats = settings.DATE_INPUT_FORMATS self.fields['event_ongoing'].choices = NO_YES_CHOICES self.fields['description'].widget = forms.Textarea() self.fields['action'].widget = forms.Textarea() self.fields['outcome'].widget = forms.Textarea() self.fields['alive_query_1'].choices = NO_YES_CHOICES self.fields['alive_query_2'].choices = NO_YES_CHOICES self.fields['alive_query_3'].choices = NO_YES_CHOICES self.fields['alive_query_4'].choices = NO_YES_CHOICES self.fields['alive_query_5'].choices = NO_YES_CHOICES self.fields['alive_query_6'].choices = NO_YES_CHOICES self.fields['alive_query_7'].choices = NO_YES_CHOICES self.fields['alive_query_8'].choices = NO_YES_CHOICES self.fields['alive_query_9'].choices = NO_YES_CHOICES self.fields['rehospitalisation'].choices = NO_YES_CHOICES self.fields['date_of_admission'].input_formats = settings.DATE_INPUT_FORMATS self.fields['date_of_discharge'].input_formats = settings.DATE_INPUT_FORMATS self.fields['admitted_to_itu'].choices = NO_YES_CHOICES self.fields['dialysis_needed'].choices = NO_YES_CHOICES self.fields['biopsy_taken'].choices = NO_YES_CHOICES self.fields['surgery_required'].choices = NO_YES_CHOICES self.fields['death'].choices = NO_YES_CHOICES self.fields['date_of_death'].input_formats = settings.DATE_INPUT_FORMATS self.fields['date_of_death'].required = False self.fields['date_of_death_unknown'].required = False self.fields['treatment_related'].choices = YES_NO_UNKNOWN_CHOICES self.fields['contact'].choices = Person.objects.\ filter(groups__id=Person.LOCAL_INVESTIGATOR).\ annotate(full_name=Concat('first_name', Value(' '), 'last_name')).\ values_list('id', 'full_name') try: if self.instance.organ.safe_recipient: self.fields['date_of_death'].initial = self.instance.organ.safe_recipient.person.date_of_death self.fields['date_of_death_unknown'].initial = self.instance.organ.safe_recipient.person.date_of_death_unknown except Organ.DoesNotExist: pass self.helper = FormHelper(self) self.helper.form_tag = False self.helper.html5_required = True self.helper.layout = Layout( FormPanel("Part 1", Layout( self.organ_field, Div( Div( Field('serious_eligible_1', template="bootstrap3/layout/radioselect-buttons.html"), Field('serious_eligible_2', template="bootstrap3/layout/radioselect-buttons.html"), Field('serious_eligible_3', template="bootstrap3/layout/radioselect-buttons.html"), css_class="col-md-6", style="margin-top: 10px;" ), Div( Field('serious_eligible_4', template="bootstrap3/layout/radioselect-buttons.html"), Field('serious_eligible_5', template="bootstrap3/layout/radioselect-buttons.html"), Field('serious_eligible_6', template="bootstrap3/layout/radioselect-buttons.html"), css_class="col-md-6", style="margin-top: 10px;" ), css_class="row" ) )), FormPanel("Part 2", Layout( Div( Div( DateField('onset_at_date'), css_class="col-md-6", style="margin-top: 10px;" ), Div( Field('event_ongoing', template="bootstrap3/layout/radioselect-buttons.html"), css_class="col-md-6", style="margin-top: 10px;" ), css_class="row" ), 'description', 'action', 'outcome', Div( # HTML("<p>Q5: if alive?</p>"), Div( Field('alive_query_1', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_2', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_3', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_4', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_5', template="bootstrap3/layout/radioselect-buttons.html"), css_class="col-md-6", style="margin-top: 10px;" ), Div( Field('alive_query_6', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_7', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_8', template="bootstrap3/layout/radioselect-buttons.html"), Field('alive_query_9', template="bootstrap3/layout/radioselect-buttons.html"), css_class="col-md-6", style="margin-top: 10px;" ), css_class="row" ), FieldWithFollowup( Field('rehospitalisation', template="bootstrap3/layout/radioselect-buttons.html"), Layout( DateField('date_of_admission'), DateField('date_of_discharge'), Field('admitted_to_itu', template="bootstrap3/layout/radioselect-buttons.html"), Field('dialysis_needed', template="bootstrap3/layout/radioselect-buttons.html"), Field('biopsy_taken', template="bootstrap3/layout/radioselect-buttons.html"), Field('surgery_required', template="bootstrap3/layout/radioselect-buttons.html"), 'rehospitalisation_comments', ) ), FieldWithFollowup( Field('death', template="bootstrap3/layout/radioselect-buttons.html"), Layout( FieldWithNotKnown( DateField('date_of_death', notknown=True), 'date_of_death_unknown', label=Patient._meta.get_field("date_of_death").verbose_name.title() ), Field('treatment_related', template="bootstrap3/layout/radioselect-buttons.html"), HTML("<p>Cause of death, tick all that apply</p>"), Div( 'cause_of_death_1', 'cause_of_death_2', 'cause_of_death_3', css_class="col-md-6", style="margin-top: 10px;" ), Div( 'cause_of_death_4', 'cause_of_death_5', 'cause_of_death_6', 'cause_of_death_comment', css_class="col-md-6", style="margin-top: 10px;" ), ) ), )), # ForeignKeyModal('contact'), -- remove the ability to create new users here as they are not Local Investigators #339 Field('contact'), )