Ejemplo n.º 1
0
def append_person_columns(entity):
    household_id = IntegerColumn('household_id', entity)
    first_name = VarCharColumn('first_name', entity, maximum=30)
    last_name = VarCharColumn('last_name', entity, maximum=30)

    # Create gender lookup column and attach value list
    gender = LookupColumn('gender', entity)
    gender_value_list = create_gender_lookup(entity)
    gender.value_list = gender_value_list

    entity.add_column(household_id)
    entity.add_column(first_name)
    entity.add_column(last_name)
    entity.add_column(gender)
Ejemplo n.º 2
0
    def __init__(self, name, profile):
        #Assert if 'check' prefix has been appended.
        name = self._append_check(name)

        Entity.__init__(self, name, profile, supports_documents=False)

        self.user_editable = False

        self.code_column = VarCharColumn('code', self, minimum=0, maximum=5)
        self.value_column = VarCharColumn('value', self, minimum=2, maximum=50)
        self.values = OrderedDict()

        #Attach columns
        self.add_column(self.code_column)
        self.add_column(self.value_column)

        LOGGER.debug('%s ValueList initialized.', self.name)
Ejemplo n.º 3
0
 def _validate_custom_attr_dummy_column(self, custom_entity):
     # Check if the dummy column has been added to the custom tenure entity
     # Insert dummy column so that the table is not flagged as a m2m
     dummy_col = custom_entity.column(self.CUSTOM_TENURE_DUMMY_COLUMN)
     if dummy_col is None:
         dummy_col = VarCharColumn(self.CUSTOM_TENURE_DUMMY_COLUMN,
                                   custom_entity,
                                   maximum=1)
         custom_entity.add_column(dummy_col)
Ejemplo n.º 4
0
    def __init__(self, profile):
        Entity.__init__(self,
                        'admin_spatial_unit_set',
                        profile,
                        is_global=True,
                        is_proxy=True,
                        supports_documents=False)

        self.user_editable = False

        self.admin_unit_name = VarCharColumn('name', self, maximum=70)
        self.admin_unit_code = VarCharColumn('code', self, maximum=10)

        LOGGER.debug('%s Administrative Spatial Unit set initialized.',
                     self.name)

        #Add columns
        self.add_column(self.admin_unit_name)
        self.add_column(self.admin_unit_code)
Ejemplo n.º 5
0
    def __init__(self, profile):
        Entity.__init__(self,
                        'supporting_document',
                        profile,
                        supports_documents=False)

        self.user_editable = False

        self.creation_date = DateTimeColumn('creation_date', self)
        self.document_identifier = VarCharColumn('document_identifier',
                                                 self,
                                                 maximum=50)
        self.document_type = VarCharColumn('source_entity', self, maximum=150)
        self.document_size = IntegerColumn('document_size', self)
        self.filename = VarCharColumn('filename', self, maximum=200)

        LOGGER.debug('%s supporting document initialized.', self.name)

        # Add columns to the entity
        self.add_column(self.creation_date)
        self.add_column(self.document_identifier)
        self.add_column(self.document_type)
        self.add_column(self.document_size)
        self.add_column(self.filename)
Ejemplo n.º 6
0
 def _validate_custom_attr_dummy_column(self, custom_entity):
     # Check if the dummy column has been added to the custom tenure entity
     # Insert dummy column so that the table is not flagged as a m2m
     dummy_col = custom_entity.column(self.CUSTOM_TENURE_DUMMY_COLUMN)
     if dummy_col is None:
         dummy_col = VarCharColumn(
             self.CUSTOM_TENURE_DUMMY_COLUMN,
             custom_entity,
             maximum=1
         )
         custom_entity.add_column(dummy_col)
     if pg_table_exists(custom_entity.name):
         custom_ent_cols = table_column_names(custom_entity.name)
         if dummy_col.name not in custom_ent_cols:
             custom_table = alchemy_table(custom_entity.name)
             varchar_updater(dummy_col, custom_table, custom_ent_cols)
Ejemplo n.º 7
0
    def __init__(self, profile):
        Entity.__init__(self,
                        'auto_generate_code',
                        profile,
                        is_global=False,
                        is_proxy=False,
                        supports_documents=False)

        self.user_editable = False

        self.auto_generate_code_name = VarCharColumn('code', self, maximum=50)

        LOGGER.debug('%s Auto Generate Code entity initialized.', self.name)

        # Add columns
        self.add_column(self.auto_generate_code_name)
Ejemplo n.º 8
0
def append_community_columns(community):
    name = VarCharColumn('comm_name', community, maximum=100)
    community.add_column(name)
Ejemplo n.º 9
0
def append_surveyor_columns(surveyor):
    first_name = VarCharColumn('first_name', surveyor, maximum=30)
    last_name = VarCharColumn('last_name', surveyor, maximum=30)
    surveyor.add_column(first_name)
    surveyor.add_column(last_name)