Exemple #1
0
    def __init__(self, data=None, *args, **kwargs):
        super(QualityOfLifeForm, self).__init__(data=data, *args, **kwargs)
        self.render_required_fields = True
        self.fields['recipient'].choices = Recipient.objects.\
            select_related('organ').values_list('id', 'organ__trial_id')
        self.fields['date_recorded'].input_formats = settings.DATE_INPUT_FORMATS
        self.fields['qol_mobility'].choices = self.QOL_CHOICES
        self.fields['qol_selfcare'].choices = self.QOL_CHOICES
        self.fields['qol_usual_activities'].choices = self.QOL_CHOICES
        self.fields['qol_pain'].choices = self.QOL_CHOICES
        self.fields['qol_anxiety'].choices = self.QOL_CHOICES

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.html5_required = True
        self.helper.layout = Layout(
            Div(
                Div(
                    'recipient',
                    Field('qol_mobility', template="bootstrap3/layout/radioselect-buttons.html"),
                    Field('qol_selfcare', template="bootstrap3/layout/radioselect-buttons.html"),
                    Field('qol_usual_activities', template="bootstrap3/layout/radioselect-buttons.html"),
                    css_class="col-md-6"
                ),
                Div(
                    DateField('date_recorded'),
                    Field('qol_pain', template="bootstrap3/layout/radioselect-buttons.html"),
                    Field('qol_anxiety', template="bootstrap3/layout/radioselect-buttons.html"),
                    'vas_score',
                    css_class="col-md-6"
                ),
                css_class="row",
            ),
        )
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(ProcurementResourceForm, self).__init__(*args, **kwargs)
        self.render_required_fields = True
        self.fields['organ'].widget = forms.HiddenInput()
        self.fields['type'].widget = forms.HiddenInput()
        self.fields['type'].choices = ProcurementResource.TYPE_CHOICES
        self.fields['expiry_date'].input_formats = settings.DATE_INPUT_FORMATS

        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.html5_required = True
        self.helper.layout = Layout(
            'organ', Field('type',
                           template="bootstrap3/layout/read-only.html"),
            'lot_number',
            FieldWithNotKnown(DateField('expiry_date', notknown=True),
                              'expiry_date_unknown',
                              label=ProcurementResource._meta.get_field(
                                  "expiry_date").verbose_name.title()))
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(EventStartForm, self).__init__(*args, **kwargs)
        self.fields['onset_at_date'].input_formats = settings.DATE_INPUT_FORMATS
        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')

        self.helper = FormHelper(self)
        self.helper.form_tag = False
        self.helper.html5_required = True
        self.helper.layout = Layout(
            FormPanel("Start a new event", Layout(
                self.organ_field,
                DateField('onset_at_date'),
                # ForeignKeyModal('contact'), -- remove the ability to create new users here as they are not Local Investigators #339
                Field('contact'),
            )),
        )
Exemple #4
0
class OrganPersonForm(forms.ModelForm):
    layout_person = Layout(
        Field('number', placeholder="___ ___ ____"),
        FieldWithNotKnown(DateField('date_of_birth', notknown=True),
                          'date_of_birth_unknown',
                          label=Patient._meta.get_field(
                              "date_of_birth").verbose_name.title()),
        Field('gender', template="bootstrap3/layout/radioselect-buttons.html"),
        'weight', 'height',
        Field('ethnicity',
              template="bootstrap3/layout/radioselect-buttons.html"),
        Field('blood_group',
              template="bootstrap3/layout/radioselect-buttons.html"))

    def __init__(self, *args, **kwargs):
        super(OrganPersonForm, self).__init__(*args, **kwargs)
        self.fields['number'].required = False
        self.fields[
            'date_of_birth'].input_formats = settings.DATE_INPUT_FORMATS
        self.fields['gender'].choices = Patient.GENDER_CHOICES
        self.fields['ethnicity'].choices = Patient.ETHNICITY_CHOICES
        self.fields['blood_group'].choices = Patient.BLOOD_GROUP_CHOICES

        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.html5_required = True
        self.helper.layout = Layout(
            HTML("<div class=\"col-md-4\" style=\"margin-top: 10px\">"),
            FormPanel("Patient Description", self.layout_person))

    class Meta:
        model = Patient
        fields = [
            'number', 'date_of_birth', 'date_of_birth_unknown', 'gender',
            'weight', 'height', 'ethnicity', 'blood_group'
        ]
        localized_fields = "__all__"
Exemple #5
0
    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',
        )
Exemple #6
0
    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
        )
Exemple #7
0
    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
        )
Exemple #8
0
    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'),
        )