def row_to_resource(row):
    """
    Transforms raw row from resource's table to resource representation
    >>> import pprint
    >>> pprint.pprint(row_to_resource({
    ...     'resource': {'name': []},
    ...     'ts': 'ts',
    ...     'txid': 'txid',
    ...     'resource_type': 'Patient',
    ...     'meta': {'tag': 'created'},
    ...     'id': 'id',
    ... }))
    {'id': 'id',
     'meta': {'lastUpdated': 'ts', 'versionId': 'txid'},
     'name': [],
     'resourceType': 'Patient'}
    """
    resource = row['resource']
    meta = row['resource'].get('meta', {})
    meta.update({
        'lastUpdated': row['ts'],
        'versionId': str(row['txid']),
    })
    resource.update(
        {
            'resourceType': row['resource_type'],
            'id': row['id'],
            'meta': meta,
        }
    )
    return resource