def update_datapackage(datapackage, mappings):
    """Update the field names and delete the `maps_to` properties."""

    for i, resource in enumerate(datapackage['resources']):
        fields = []

        for field in resource['schema']['fields']:
            fiscal_key = mappings[i][field['name']]

            if fiscal_key not in ('_unknown', '_ignored'):
                field.update({'name': fiscal_key})
                del field['maps_to']
                if 'translates_to' in field:
                    del field['translates_to']
                fields.append(field)

        resource['schema']['fields'] = fields

    return datapackage