示例#1
0
    def test_should_handle_questions_with_similar_label(self):
        self.data = [[
            "What is the reporting period for the activity?\n\n Answer must be a date in the following format: day.month.year\n\n Example: 25.12.2011",
            "Name", "Name 1"
        ], ["12.12.2012", "name11", "name12"],
                     ["11.11.2012", "name21", "name22"],
                     ["12.10.2012", "name31", "name32"]]
        field = TextField(name="Q3", code="NAME", label="Name")
        self.form_model.add_field(field)
        field = TextField(name="Q4", code="NAME1", label="Name 1")
        self.form_model.add_field(field)
        expected_ans_dict = [{
            'DATE': '12.12.2012',
            'NAME': 'name11',
            'NAME1': 'name12'
        }, {
            'DATE': '11.11.2012',
            'NAME': 'name21',
            'NAME1': 'name22'
        }, {
            'DATE': '12.10.2012',
            'NAME': 'name31',
            'NAME1': 'name32'
        }]

        self.assertEquals(
            expected_ans_dict,
            SubmissionWorkbookMapper(self.data, self.form_model).process())
示例#2
0
 def setUp(self):
     self.validator = MandatoryValidator()
     self.field1 = TextField('a', 'a', 'a')
     self.field2 = TextField('b', 'b', 'b', required=False)
     self.field3 = TextField('c', 'c', 'c')
     self.field4 = TextField('d', 'd', 'd')
     self.fields = [self.field1, self.field2, self.field3, self.field4]
示例#3
0
 def test_should_return_max_code_in_questionnaire(self):
     fields = [TextField(name="f1", code="q1", label="f1"),
               TextField(name="f2", code="q2", label="f2"),
               TextField(name="f3", code="q3", label="f3"),
               TextField(name="f3", code="q4", label="f4"),
               TextField(name="f5", code="q5", label="f5")]
     self.assertEqual(5, get_max_code(fields))
示例#4
0
 def test_should_return_one_in_questionnaire_without_start_with_q(self):
     fields = [TextField(name="f1", code="c1", label="f1"),
               TextField(name="f2", code="c2", label="f2"),
               TextField(name="f3", code="c3", label="f3"),
               TextField(name="f3", code="c4", label="f4"),
               TextField(name="f5", code="c5", label="f5")]
     self.assertEqual(1, get_max_code(fields))
示例#5
0
 def create_form_for_entity_type(self):
     string_data_type = get_or_create_data_dict(self.manager,
                                                name='Name',
                                                slug='name',
                                                primitive_type='string')
     school_name_field = TextField(name="name",
                                   code="q1",
                                   label="What's the name?",
                                   ddtype=string_data_type)
     address_field = TextField(name="address",
                               code="q2",
                               label="Where is the clinic?",
                               ddtype=string_data_type)
     unique_id_field = TextField(
         name="unique_id",
         code="q3",
         label="What is the clinic's Unique ID Number?",
         ddtype=string_data_type,
         entity_question_flag=True)
     form_model = FormModel(
         self.manager,
         "clinic",
         form_code=FORM_CODE,
         entity_type=["clinic"],
         is_registration_model=True,
         fields=[school_name_field, address_field, unique_id_field])
     form_model.save()
示例#6
0
 def _create_form_model_for_project(self, project):
     ddtype = DataDictType(self.dbm,
                           name='Default String Datadict Type',
                           slug='string_default',
                           primitive_type='string')
     question1 = TextField(name="entity_question",
                           code="ID",
                           label="What is associated entity",
                           language="eng",
                           entity_question_flag=True,
                           ddtype=ddtype)
     question2 = TextField(name="question1_Name",
                           code="Q1",
                           label="What is your name",
                           defaultValue="some default value",
                           language="eng",
                           length=TextConstraint(5, 10),
                           ddtype=ddtype)
     self.form_model = FormModel(self.dbm,
                                 name=self.project1.name,
                                 form_code="abc",
                                 fields=[question1, question2],
                                 entity_type=["Clinic"],
                                 state=attributes.INACTIVE_STATE)
     qid = self.form_model.save()
     project.qid = qid
     project.save(self.dbm)
示例#7
0
 def setUp(self):
     self.data = [
         [
             "What is the reporting period for the activity?\n\n Answer must be a date in the following format: day.month.year\n\n Example: 25.12.2011"
         ],
         ["12.12.2012"],
         ["11.11.2012"],
         ["12.10.2012"],
     ]
     self.user = Mock(User)
     self.dbm = Mock(spec=DatabaseManager)
     self.default_ddtype = DataDictType(self.dbm,
                                        name='Default String Datadict Type',
                                        slug='string_default',
                                        primitive_type='string')
     fields = \
         [TextField(name="Q1", code="EID", label="What is the reporter ID?", entity_question_flag=True,
                    ddtype=self.default_ddtype),
          TextField(name="Q2", code="DATE", label="What is the reporting period for the activity?",
                    entity_question_flag=False, ddtype=self.default_ddtype)]
     self.form_model = FormModel(self.dbm,
                                 "abc",
                                 "abc",
                                 entity_type=["clinic"],
                                 form_code="cli001",
                                 fields=fields,
                                 type="survey")
     self.project = Mock(Project)
示例#8
0
def create_ds_mapping(dbm, form_model):
    es = get_elasticsearch_handle()
    fields = form_model.fields
    fields.append(TextField(name="projects", code='projects', label='projects'))
    fields.append(TextField(name="groups", code='groups', label='My Groups'))
    fields.append(TextField(name="customgroups", code='customgroups', label='Custom groups'))
    es.put_mapping(dbm.database_name, REPORTER_ENTITY_TYPE[0], get_fields_mapping(REPORTER_ENTITY_TYPE[0], fields))
示例#9
0
    def _build_fixtures(self):
        entity_type = ["clinic"]
        default_ddtype = DataDictType(self.manager,
                                      name='default dd type',
                                      slug='string_default',
                                      primitive_type='string')

        entity_field = TextField('clinic',
                                 'ID',
                                 'clinic label',
                                 default_ddtype,
                                 entity_question_flag=True)
        beds_field = IntegerField('beds', 'BEDS', 'beds label', default_ddtype)
        doctor_field = TextField('beds', 'DOCTOR', 'doctor label',
                                 default_ddtype)
        meds_field = IntegerField('meds', 'MEDS', 'meds label', default_ddtype)

        FormModelBuilder(self.manager, entity_type, 'clf1').add_field(entity_field)\
                                                            .add_field(beds_field)\
                                                            .add_field(doctor_field)\
                                                            .add_field(meds_field)\
                                                            .build()
        [
            EntityBuilder(self.manager, entity_type, 'cl00%d' % i).build()
            for i in range(1, 6)
        ]
示例#10
0
 def test_should_return_max_code_in_questionnaire(self):
     ddtype = Mock(spec=DataDictType)
     fields = [TextField(name="f1", code="q1", label="f1", ddtype=ddtype),
               TextField(name="f2", code="q2", label="f2", ddtype=ddtype),
               TextField(name="f3", code="q3", label="f3", ddtype=ddtype),
               TextField(name="f3", code="q4", label="f4", ddtype=ddtype),
               TextField(name="f5", code="q5", label="f5", ddtype=ddtype)]
     self.assertEqual(5, get_max_code(fields))
示例#11
0
 def test_should_remove_default_entity_field(self):
     ddtype = Mock(spec=DataDictType)
     question1 = TextField(label="entity_question", code="ID", name="What is associated entity",
                           language="eng", entity_question_flag=True, ddtype=ddtype)
     question2 = TextField(label="question1_Name", code="Q1", name="What is your name",
                           defaultValue="some default value", language="eng", ddtype=ddtype)
     cleaned_list = helper.hide_entity_question([question1, question2])
     self.assertEquals([question2], cleaned_list)
示例#12
0
 def test_should_return_one_in_questionnaire_without_start_with_q(self):
     ddtype = Mock(spec=DataDictType)
     fields = [TextField(name="f1", code="c1", label="f1", ddtype=ddtype),
               TextField(name="f2", code="c2", label="f2", ddtype=ddtype),
               TextField(name="f3", code="c3", label="f3", ddtype=ddtype),
               TextField(name="f3", code="c4", label="f4", ddtype=ddtype),
               TextField(name="f5", code="c5", label="f5", ddtype=ddtype)]
     self.assertEqual(1, get_max_code(fields))
示例#13
0
 def create_form_for_entity_type(self):
     school_name_field = TextField(name="name", code="q1", label="What's the name?")
     address_field = TextField(name="address", code="q2", label="Where is the clinic?")
     unique_id_field = UniqueIdField('clinic',name="unique_id", code="q3", label="What is the clinic's Unique ID Number?")
     form_model = FormModel(self.manager, "clinic", form_code=FORM_CODE, entity_type=["clinic"],
                            is_registration_model=True,
                            fields=[school_name_field, address_field, unique_id_field])
     form_model.save()
示例#14
0
 def test_should_create_header_list(self):
     ddtype = Mock(spec=DataDictType)
     question1 = TextField(label="entity_question", code="ID", name="What is associated entity",
                           language="eng", entity_question_flag=True, ddtype=ddtype)
     question2 = TextField(label="question1_Name", code="Q1", name="What is your name",
                           defaultValue="some default value", language="eng", ddtype=ddtype)
     actual_list = helper.get_headers([question1, question2])
     expected_list = ["What is associated entity", "What is your name"]
     self.assertListEqual(expected_list, actual_list)
示例#15
0
 def test_should_return_code_title_tuple_list(self):
     ddtype = Mock(spec=DataDictType)
     question1 = TextField(label="entity_question", code="ID", name="What is associated entity",
                           language="eng", entity_question_flag=True, ddtype=ddtype)
     question2 = TextField(label="question1_Name", code="Q1", name="What is your name",
                           defaultValue="some default value", language="eng", ddtype=ddtype)
     self.assertEquals([("ID", "What is associated entity"), ("Q1", "What is your name")],
                                                                                         helper.get_code_and_title(
                                                                                             [question1, question2]))
示例#16
0
 def test_successful_text_length_validation(self):
     field = TextField(name="Name", code="Q2", label="What is your Name",
                       language="eng", length=TextConstraint(min=4, max=15), ddtype=self.ddtype)
     field1 = TextField(name="Name", code="Q2", label="What is your Name",
                        language="eng", ddtype=self.ddtype)
     valid_value = field.validate("valid")
     self.assertEqual(valid_value, "valid")
     valid_value = field1.validate("valid")
     self.assertEqual(valid_value, "valid")
示例#17
0
 def setUp(self):
     self.validator = UniqueIdExistsValidator()
     self.field1 = TextField('a', 'a', 'a')
     self.field2 = TextField('b', 'b', 'b')
     self.field3 = UniqueIdField('unique_id_type1', 'name1', 'code1', 'label1')
     self.field4 = UniqueIdField('unique_id_type2', 'name2', 'code2', 'label2')
     self.fields = [self.field1, self.field2, self.field3,
                    self.field4
     ]
示例#18
0
 def test_successful_text_length_validation(self):
     field = TextField(name="Name",
                       code="Q2",
                       label="What is your Name",
                       constraints=[TextLengthConstraint(min=4, max=15)])
     field1 = TextField(name="Name", code="Q2", label="What is your Name")
     valid_value = field.validate("valid")
     self.assertEqual(valid_value, "valid")
     valid_value = field1.validate("valid")
     self.assertEqual(valid_value, "valid")
    def test_should_set_initial_values_for_submissions_with_upper_case_question_codes(
            self):
        initial_dict = {'Q1': 'Ans1', 'Q2': 'Ans2'}
        type(self.project).fields = PropertyMock(return_value=[
            TextField(name="Q1", code="Q1", label="some"),
            TextField(name="Q2", code="Q2", label="some")
        ])
        submission_form = SurveyResponseForm(self.project, initial_dict)

        self.assertEquals('Ans1', submission_form.fields.get('Q1').initial)
        self.assertEquals('Ans2', submission_form.fields.get('Q2').initial)
示例#20
0
 def test_should_convert_field_list_with_apostrophe_to_string(self):
     field1 = TextField(name="Test's",
                        code="AA",
                        label="test",
                        ddtype=self.ddtype)
     field2 = TextField(name="Question's",
                        code="AB",
                        label="question",
                        ddtype=self.ddtype)
     test_string = json.dumps([field1, field2], default=field_to_json)
     expected_string = '[{"code": "AA", "name": "Test\'s", "defaultValue": "", "instruction": null, "label": {"eng": "test"}, "length": {}, "ddtype": {"test": "test"}, "type": "text"}, {"code": "AB", "name": "Question\'s", "defaultValue": "", "instruction": null, "label": {"eng": "question"}, "length": {}, "ddtype": {"test": "test"}, "type": "text"}]'
     self.assertEquals(expected_string, test_string)
示例#21
0
    def test_should_should_get_fields_values_after_question_count_changed(
            self):
        eid_field = TextField(label="What is associated entity?",
                              code="EID",
                              name="What is associatéd entity?",
                              entity_question_flag=True,
                              ddtype=self.ddtype)
        rp_field = DateField(label="Report date",
                             code="RD",
                             name="What is réporting date?",
                             date_format="dd.mm.yyyy",
                             event_time_field_flag=True,
                             ddtype=self.ddtype)
        symptoms_field = TextField(label="Zhat are symptoms?",
                                   code="SY",
                                   name="Zhat are symptoms?",
                                   ddtype=self.ddtype)
        gps = TextField(label="What is your blood group?",
                        code="GPS",
                        name="What is your gps?",
                        ddtype=self.ddtype)
        form_model = FormModelBuilder(self.manager, ['clinic'],
                                      form_code='cli001').add_fields(
                                          eid_field, rp_field, symptoms_field,
                                          gps).build()

        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.12.2012',
            'SY': 'Fever',
            'GPS': 'NewYork'
        })

        form_model.create_snapshot()
        form_model.delete_field("SY")
        form_model.save()

        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.12.2012',
            'GPS': '1,1'
        })

        submissions = successful_submissions(self.manager,
                                             form_model.form_code)
        analyzer = SubmissionAnalyzer(form_model, self.manager, self.org_id,
                                      submissions)
        values = analyzer.get_raw_values()

        self.assertEqual(['1,1'], values[0][5:])
        self.assertEqual(['NewYork'], values[1][5:])
    def setUp(self):
        self.dbm = Mock(spec=DatabaseManager)
        self.datadict_patcher = patch(
            "mangrove.form_model.form_model.get_or_create_data_dict")
        self.datadict_mock = self.datadict_patcher.start()
        self.ddtype_mock = Mock(spec=DataDictType)
        self.datadict_mock.return_value = self.ddtype_mock

        q1 = TextField(name="entity_question",
                       code="ID",
                       label="What is associated entity",
                       language="eng",
                       entity_question_flag=True,
                       ddtype=self.ddtype_mock)
        q2 = TextField(name="question1_Name",
                       code="Q1",
                       label="What is your name",
                       defaultValue="some default value",
                       language="eng",
                       length=TextConstraint(5, 10),
                       ddtype=self.ddtype_mock)
        q3 = IntegerField(name="Father's age",
                          code="Q2",
                          label="What is your Father's Age",
                          range=NumericConstraint(min=15, max=120),
                          ddtype=self.ddtype_mock)
        q4 = SelectField(name="Color",
                         code="Q3",
                         label="What is your favourite color",
                         options=[("RED", 1), ("YELLOW", 2)],
                         ddtype=self.ddtype_mock)
        q5 = TextField(name="Desc",
                       code="Q4",
                       label="Description",
                       ddtype=self.ddtype_mock)

        self.form_model = FormModel(
            self.dbm,
            entity_type=["XYZ"],
            name="aids",
            label="Aids form_model",
            form_code="1",
            type='survey',
            fields=[  #        expected_short_code = "dog3"
                #        self.assertEqual(response.short_code, expected_short_code)
                #        b = get_by_short_code(self.dbm, expected_short_code, ["dog"])
                #        self.assertEqual(b.short_code, expected_short_code)
                q1,
                q2,
                q3,
                q4,
                q5
            ])
 def create_test_fields_and_survey(self):
     #change this to reporter
     #entity_field = TextField('clinic', 'ID', 'clinic label', entity_question_flag=True)
     city_field = TextField('city', 'city', 'What is the City name?')
     name_field = TextField('centername', 'centername', 'Center Name?')
     area_field = TextField('area', 'area', 'Area?')
     center_field_set = FieldSet('center', 'center', 'Center Information', field_set=[name_field, area_field])
     form_fields = [#entity_field,
                    city_field, center_field_set]
     survey_response_values = {'city': 'Bhopal',
                               'center': [{'centername': 'Boot', 'area': 'New Market'},
                                          {'centername': 'Weene', 'area': 'Bgh'}], 'eid': 'rep276'}
     return form_fields, survey_response_values
示例#24
0
 def _create_subject_registration_form(self):
     eid_field = TextField(label="What is associated entity?",
                           code="EID",
                           name="What is associatéd entity?",
                           entity_question_flag=True,
                           ddtype=self.entity_id_type)
     blood_type_field = TextField(label="What is your blood group?",
                                  code="BG",
                                  name="What is your blood group?",
                                  ddtype=self.entity_id_type)
     return FormModelBuilder(
         self.manager, ["clinic"]).is_registration_model(True).add_fields(
             eid_field, blood_type_field).build()
    def test_should_set_initial_values_for_submissions_with_upper_case_question_codes(
            self):
        initial_dict = {'Q1': 'Ans1', 'Q2': 'Ans2'}
        type(self.form_model).fields = PropertyMock(return_value=[
            TextField(name="Q1", code="Q1", label="some", ddtype=self.ddtype),
            TextField(name="Q2", code="Q2", label="some", ddtype=self.ddtype)
        ])
        type(self.form_model).entity_question = PropertyMock(return_value=None)
        submission_form = EditSubmissionForm(self.manager, self.project,
                                             self.form_model, initial_dict)

        self.assertEquals('Ans1', submission_form.fields.get('Q1').initial)
        self.assertEquals('Ans2', submission_form.fields.get('Q2').initial)
示例#26
0
    def test_should_save_submitted_sms_for_activity_report(self):
        question1 = TextField(name="entity_question",
                              code="EID",
                              label="What is associated entity",
                              language="eng",
                              entity_question_flag=True,
                              ddtype=self.entity_id_type)
        question2 = TextField(name="Name",
                              code="NAME",
                              label="Clinic Name",
                              defaultValue="some default value",
                              language="eng",
                              length=TextConstraint(4, 15),
                              ddtype=self.name_type)
        question3 = IntegerField(name="Arv stock",
                                 code="ARV",
                                 label="ARV Stock",
                                 range=NumericConstraint(min=15, max=120),
                                 ddtype=self.stock_type)
        activity_report = FormModel(self.dbm,
                                    entity_type=["reporter"],
                                    name="report",
                                    label="reporting form_model",
                                    form_code="acp",
                                    type='survey',
                                    fields=[question1, question2, question3])
        activity_report.save()

        text = "acp +name tester +ARV 50 "

        response = self.send_sms(text)

        self.assertTrue(response.success)
        self.assertEqual(u"Test_reporter",
                         response.reporters[0].get(NAME_FIELD))

        data_record_id = response.datarecord_id
        data_record = self.dbm._load_document(
            id=data_record_id, document_class=DataRecordDocument)
        self.assertEqual(self.name_type.slug,
                         data_record.data["Name"]["type"]["slug"])
        self.assertEqual(self.stock_type.slug,
                         data_record.data["Arv stock"]["type"]["slug"])
        self.assertEqual("acp", data_record.submission['form_code'])
        data = self.reporter.values({"Name": "latest", "Arv stock": "latest"})
        self.assertEquals(data["Arv stock"], 50)
        self.assertEquals(data["Name"], "tester")
        submission_log = self.dbm._load_document(response.submission_id,
                                                 SubmissionLogDocument)
        self.assertEquals(data_record_id, submission_log.data_record_id)
示例#27
0
 def test_should_update_questionnaire(self):
     dbm = Mock(spec=DatabaseManager)
     ddtype = Mock(spec=DataDictType)
     question1 = TextField(label="name", code="na", name="What is your name",
                           language="eng", ddtype=ddtype)
     question2 = TextField(label="address", code="add", name="What is your address",
                           defaultValue="some default value", language="eng", ddtype=ddtype)
     post = {"title": "What is your age", "code": "age", "type": "integer", "choices": [],
             "is_entity_question": False,
             "range_min": 0, "range_max": 100}
     form_model = FormModel(dbm, name="test", label="test", form_code="fc", fields=[question1, question2],
                            entity_type=["reporter"], type="survey")
     form_model2 = helper.update_questionnaire_with_questions(form_model, [post], dbm)
     self.assertEquals(2, len(form_model2.fields))
示例#28
0
    def test_should_set_field_initial_value_as_none_if_not_populated(self):
        empty_field = TextField(name="text",
                                code="code",
                                label="what is ur name")
        empty_field.value = None
        form_model = FormModel(Mock(spec=DatabaseManager))
        form_model.add_field(empty_field)

        mock_subject = Mock(spec=Entity)
        type(mock_subject).data = PropertyMock(return_value={})

        initialize_values(form_model, mock_subject)

        self.assertEquals(None, empty_field.value)
示例#29
0
    def setUp(self):
        self.dbm = Mock(spec=DatabaseManager)

        q1 = UniqueIdField('clinic',
                           name="entity_question",
                           code="ID",
                           label="What is associated entity")
        q2 = TextField(name="question1_Name",
                       code="Q1",
                       label="What is your name",
                       defaultValue="some default value",
                       constraints=[TextLengthConstraint(5, 10)],
                       required=False)
        q3 = IntegerField(
            name="Father's age",
            code="Q2",
            label="What is your Father's Age",
            constraints=[NumericRangeConstraint(min=15, max=120)],
            required=False)
        q4 = SelectField(name="Color",
                         code="Q3",
                         label="What is your favourite color",
                         options=[("RED", 'a'), ("YELLOW", 'b')],
                         required=False)
        q5 = TextField(name="Desc",
                       code="Q4",
                       label="Description",
                       required=False)
        self.event_time_field_code = "Q6"
        q6 = DateField(name="Event time",
                       code=self.event_time_field_code,
                       label="Event time field",
                       date_format="%m.%d.%Y",
                       required=False)
        q7 = GeoCodeField(name="My Location",
                          code="loc",
                          label="Geo Location Field",
                          required=False)
        self.form_model = FormModel(self.dbm,
                                    name="aids",
                                    label="Aids form_model",
                                    form_code="1",
                                    fields=[q1, q2, q3, q4, q5, q6, q7])

        self.form_model_patch = patch(
            'mangrove.form_model.form_model.FormModel')
        self.form_model_document_patch = patch(
            'mangrove.form_model.form_model.FormModelDocument')
示例#30
0
    def test_should_return_unique_entries_when_multiple_unique_id_fields_are_present_in_group(
            self):
        group_fields = [
            UniqueIdField("chicken",
                          "What chicken are you reporting on?",
                          "q3",
                          "What chicken are you reporting on?",
                          parent_field_code='group'),
            UniqueIdField("goats",
                          "What goat are you reporting on?",
                          "q4",
                          "What goat are you reporting on?",
                          parent_field_code='group'),
        ]
        fields = [
            TextField("Some word question", "q1", "Some word question"),
            UniqueIdField("goats", "What goat are you reporting on?", "q2",
                          "What goat are you reporting on?"),
            FieldSet('group', 'group', 'animal group', field_set=group_fields)
        ]

        fields_array = get_filterable_fields(fields, [])
        print[r for r in fields_array]
        self.assertEqual(len(fields_array), 2)
        self.assertDictEqual(fields_array[0], {
            'type': 'unique_id',
            'code': 'q2',
            'entity_type': 'goats'
        })
        self.assertDictEqual(fields_array[1], {
            'type': 'unique_id',
            'code': 'group----q3',
            'entity_type': 'chicken'
        })
示例#31
0
    def test_should_return_unique_entries_when_multiple_unique_id_fields_of_same_type_are_present_from_questionnaire(
            self):
        fields = [
            TextField("Some word question", "q1", "Some word question"),
            UniqueIdField("goats", "What goat are you reporting on?", "q2",
                          "What goat are you reporting on?"),
            UniqueIdField("chicken", "What chicken are you reporting on?",
                          "q3", "What chicken are you reporting on?"),
            UniqueIdField("goats", "What goat are you reporting on?", "q4",
                          "What goat are you reporting on?"),
        ]

        fields_array = get_filterable_fields(fields, [])
        print[r for r in fields_array]
        self.assertEqual(len(fields_array), 2)
        self.assertDictEqual(fields_array[0], {
            'type': 'unique_id',
            'code': 'q2',
            'entity_type': 'goats'
        })
        self.assertDictEqual(fields_array[1], {
            'type': 'unique_id',
            'code': 'q3',
            'entity_type': 'chicken'
        })