def setUp(self):
     self.dbm = get_db_manager(database='mangrove-test')
     self._create_entities()
     self.player = SMSPlayer(self.dbm, SubmissionHandler(self.dbm))
     self.transport = TransportInfo(transport="sms",
                                    source="1234",
                                    destination="5678")
     initializer.run(self.dbm)
Exemple #2
0
    def setUp(self):
        self.dbm = get_db_manager(database='mangrove-test')
        self.csv_data = """
"form_code","t","n","l","g","d","s","m"
"REG","reporter","Aàman Farafangana ","Farafangana ","-21.8  46.8333","This is a Clinic in near to Farafangana ",,987654328
"REG","reporter","Reporter1 Fianarantsoa ","mahajanga ","-20.45  45.1","C'est une clinique à Fianarantsoa",,987654329
"REG","reporter","Reporter2 Maintirano ","Maintirano ","-18.05  44.0333","This is a reporter in Maintirano ",,987654333
"REG","reporter","Reporter3 Mananjary ","Mananjary ","-21.2  48.3667","This is a reporter in Mananjary ",,987654334
"""
        initializer.run(self.dbm)
Exemple #3
0
    def setUp(self):
        self.dbm = get_db_manager(database='mangrove-test')
        self.csv_data = """
"form_code","t","n","l","g","d","s","m"
"REG","reporter","Aàman Farafangana ","Farafangana ","-21.8  46.8333","This is a Clinic in near to Farafangana ",,987654328
"REG","reporter","Reporter1 Fianarantsoa ","mahajanga ","-20.45  45.1","C'est une clinique à Fianarantsoa",,987654329
"REG","reporter","Reporter2 Maintirano ","Maintirano ","-18.05  44.0333","This is a reporter in Maintirano ",,987654333
"REG","reporter","Reporter3 Mananjary ","Mananjary ","-21.2  48.3667","This is a reporter in Mananjary ",,987654334
"""
        initializer.run(self.dbm)
    def setUp(self):
        self.dbm = get_db_manager(database='mangrove-test')
        initializer.run(self.dbm)
        define_type(self.dbm, ["dog"])
        self.entity_type = ["healthfacility", "clinic"]
        define_type(self.dbm, self.entity_type)
        self.name_type = DataDictType(self.dbm, name='Name', slug='name', primitive_type='string')
        self.telephone_number_type = DataDictType(self.dbm, name='telephone_number', slug='telephone_number',
                                                  primitive_type='string')
        self.entity_id_type = DataDictType(self.dbm, name='Entity Id Type', slug='entity_id', primitive_type='string')
        self.stock_type = DataDictType(self.dbm, name='Stock Type', slug='stock', primitive_type='integer')
        self.color_type = DataDictType(self.dbm, name='Color Type', slug='color', primitive_type='string')

        self.name_type.save()
        self.telephone_number_type.save()
        self.stock_type.save()
        self.color_type.save()

        self.entity = create_entity(self.dbm, entity_type=self.entity_type,
                                    location=["India", "Pune"], aggregation_paths=None, short_code="cli1",
                                    )

        self.data_record_id = self.entity.add_data(data=[("Name", "Ruby", self.name_type)],
                                                   submission=dict(submission_id="1"))

        self.reporter = create_entity(self.dbm, entity_type=["reporter"],
                                      location=["India", "Pune"], aggregation_paths=None, short_code="rep1",
                                      )

        self.reporter.add_data(data=[(MOBILE_NUMBER_FIELD, '1234', self.telephone_number_type),
                (NAME_FIELD, "Test_reporter", self.name_type)], submission=dict(submission_id="2"))

        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)
        question4 = SelectField(name="Color", code="COL", label="Color",
                                options=[("RED", 1), ("YELLOW", 2)], ddtype=self.color_type)

        self.form_model = FormModel(self.dbm, entity_type=self.entity_type, name="aids", label="Aids form_model",
                                    form_code="clinic", type='survey', fields=[question1, question2, question3])
        self.form_model.add_field(question4)
        self.form_model__id = self.form_model.save()

        self.submission_handler = SubmissionHandler(self.dbm)
        self.sms_player = SMSPlayer(self.dbm, self.submission_handler, LocationTree())
Exemple #5
0
def run(manager):
    sync_views(manager)
    mangrove_intializer.run(manager)
    create_default_reporter(manager)
Exemple #6
0
def run(manager):
    sync_views(manager)
    mangrove_intializer.run(manager)
    create_default_reporter(manager)
 def setUp(self):
     self.dbm = get_db_manager(database='mangrove-test')
     self._create_entities()
     self.player = SMSPlayer(self.dbm, SubmissionHandler(self.dbm))
     self.transport = TransportInfo(transport="sms", source="1234", destination="5678")
     initializer.run(self.dbm)
Exemple #8
0
    def setUp(self):
        self.dbm = get_db_manager(database='mangrove-test')
        initializer.run(self.dbm)
        define_type(self.dbm, ["dog"])
        self.entity_type = ["healthfacility", "clinic"]
        define_type(self.dbm, self.entity_type)
        self.name_type = DataDictType(self.dbm,
                                      name='Name',
                                      slug='name',
                                      primitive_type='string')
        self.telephone_number_type = DataDictType(self.dbm,
                                                  name='telephone_number',
                                                  slug='telephone_number',
                                                  primitive_type='string')
        self.entity_id_type = DataDictType(self.dbm,
                                           name='Entity Id Type',
                                           slug='entity_id',
                                           primitive_type='string')
        self.stock_type = DataDictType(self.dbm,
                                       name='Stock Type',
                                       slug='stock',
                                       primitive_type='integer')
        self.color_type = DataDictType(self.dbm,
                                       name='Color Type',
                                       slug='color',
                                       primitive_type='string')

        self.name_type.save()
        self.telephone_number_type.save()
        self.stock_type.save()
        self.color_type.save()

        self.entity = create_entity(
            self.dbm,
            entity_type=self.entity_type,
            location=["India", "Pune"],
            aggregation_paths=None,
            short_code="cli1",
        )

        self.data_record_id = self.entity.add_data(
            data=[("Name", "Ruby", self.name_type)],
            submission=dict(submission_id="1"))

        self.reporter = create_entity(
            self.dbm,
            entity_type=["reporter"],
            location=["India", "Pune"],
            aggregation_paths=None,
            short_code="rep1",
        )

        self.reporter.add_data(data=[
            (MOBILE_NUMBER_FIELD, '1234', self.telephone_number_type),
            (NAME_FIELD, "Test_reporter", self.name_type)
        ],
                               submission=dict(submission_id="2"))

        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)
        question4 = SelectField(name="Color",
                                code="COL",
                                label="Color",
                                options=[("RED", 1), ("YELLOW", 2)],
                                ddtype=self.color_type)

        self.form_model = FormModel(self.dbm,
                                    entity_type=self.entity_type,
                                    name="aids",
                                    label="Aids form_model",
                                    form_code="clinic",
                                    type='survey',
                                    fields=[question1, question2, question3])
        self.form_model.add_field(question4)
        self.form_model__id = self.form_model.save()

        self.submission_handler = SubmissionHandler(self.dbm)
        self.sms_player = SMSPlayer(self.dbm, self.submission_handler,
                                    LocationTree())