'Import item de-duplication'

@staticmethod
def project_indicator_deduplicate(item):

    data = item.data
    name = data.get('name')
    if name:
        table = item.table
        query = (table.name == name)
        project_id = data.get('project_id')
        if project_id:
            query &= ((table.project_id == project_id) | (table.project_id == None))
        duplicate = current.db(query).select(table.id, limitby=(0, 1)).first()
        if duplicate:
            item.id = duplicate.id
            item.method = item.METHOD.UPDATE
