Exemple #1
0
def insert_address(row_values, index):
    address_id = database_methods.get_id("Address") + 1
    val = [address_id]
    val = database_methods.fetch_values_list(row_values, index, val)
    # insert into table
    insert_helper.insert_row(val, "Address")

    return address_id
Exemple #2
0
def insert_long_term(row_values, service_id):
    '''
    Inserts a row in the Long_Term_Intervention table.
    '''
    long_term_id = database_methods.get_id("Long_Term_Intervention") + 1
    val = [long_term_id, service_id]
    # check if long term intervention was recieved
    if (type(row_values[18]) == str):
        val = database_methods.fetch_values(18, 29, row_values, val)
        insert_helper.insert_row(val, "Long_Term_Intervention")
Exemple #3
0
def insert_target_group(row_values, start, end):
    '''
    Insert a row into the Target_Group table.
    '''
    # get id to insert
    target_id = database_methods.get_id("Target_Group") + 1
    val = [target_id]
    val = database_methods.fetch_values(start, end, row_values, val)
    insert_helper.insert_row(val, "Target_Group")

    return target_id
Exemple #4
0
def insert_service(row_values, skill_idx, service_type):
    '''
    Insert a row in the Service table.
    '''
    service_id = database_methods.get_id("Service") + 1
    val = [service_id]
    val = database_methods.fetch_values(skill_idx, skill_idx + 1, row_values,
                                        val)
    val.append(service_type)
    insert_helper.insert_row(val, "Service")

    return service_id
Exemple #5
0
def insert_short_term(row_values, service_id):
    '''
    Inserts a row in the Short_Term_Intervention table.
    '''
    i = 35
    end = 44
    while (i < end):
        short_term_id = database_methods.get_id("Short_Term_Intervention") + 1
        val = [short_term_id, service_id]
        # check if short term intervention received column is not empty
        if (type(row_values[i]) == str):
            val.append(row_values[i])
            val.append(row_values[i + 1])
            insert_helper.insert_row(val, "Short_Term_Intervention")
        i += 2