db/python/tables/participant.py
async def update_participants(
        self,
        participant_ids: List[int],
        reported_sexes: List[int] = None,
        reported_genders: List[str] = None,
        karyotypes: List[str] = None,
        metas: List[Dict] = None,
        author=None,
    ):
        """
        Update many participants, expects that all lists contain the same number of values.
        You can't update selective fields on selective samples, if you provide metas, this
        function will update EVERY participant with the provided meta values.
        """
        _author = author or self.author
        updaters = ['author = :author']
        values: Dict[str, List[Any]] = {
            'pid': participant_ids,
            'author': [_author] * len(participant_ids),
        }
        if reported_sexes:
            updaters.append('reported_sex = :reported_sex')
            values['reported_sex'] = reported_sexes
        if reported_genders:
            updaters.append('reported_gender = :reported_gender')
            values['reported_gender'] = reported_genders
        if karyotypes:
            updaters.append('karyotype = :karyotype')
            values['karyotype'] = karyotypes
        if metas:
            updaters.append('meta = JSON_MERGE_PATCH(COALESCE(meta, "{}"), :meta')
            values['meta'] = metas

        keys = list(values.keys())
        list_values = [
            {k: l[idx] for k, l in values.items()}
            for idx in range(len(values[keys[0]]))
        ]

        updaters_str = ', '.join(updaters)
        _query = f'UPDATE participant SET {updaters_str} WHERE id = :pid'
        await self.connection.execute_many(_query, list_values)

        Update many participants, expects that all lists contain the same number of values.
        You can't update selective fields on selective samples, if you provide metas, this
        function will update EVERY participant with the provided meta values.
        
Update many participants, expects that all lists contain the same number of values.
You can't update selective fields on selective samples, if you provide metas, this
function will update EVERY participant with the provided meta values.
Update many participants expects that all lists contain the same number of values . You can ' t update selective fields on selective samples if you provide metas this function will update EVERY participant with the provided meta values .
async def update_participants(
        self,
        participant_ids: List[int],
        reported_sexes: List[int] = None,
        reported_genders: List[str] = None,
        karyotypes: List[str] = None,
        metas: List[Dict] = None,
        author=None,
    ):
        _author = author or self.author
        updaters = ['author = :author']
        values: Dict[str, List[Any]] = {
            'pid': participant_ids,
            'author': [_author] * len(participant_ids),
        }
        if reported_sexes:
            updaters.append('reported_sex = :reported_sex')
            values['reported_sex'] = reported_sexes
        if reported_genders:
            updaters.append('reported_gender = :reported_gender')
            values['reported_gender'] = reported_genders
        if karyotypes:
            updaters.append('karyotype = :karyotype')
            values['karyotype'] = karyotypes
        if metas:
            updaters.append('meta = JSON_MERGE_PATCH(COALESCE(meta, "{}"), :meta')
            values['meta'] = metas
        keys = list(values.keys())
        list_values = [
            {k: l[idx] for k, l in values.items()}
            for idx in range(len(values[keys[0]]))
        ]
        updaters_str = ', '.join(updaters)
        _query = f'UPDATE participant SET {updaters_str} WHERE id = :pid'
        await self.connection.execute_many(_query, list_values)
async def update_participants ( self , participant_ids : List [ int ] , reported_sexes : List [ int ] = None , reported_genders : List [ str ] = None , karyotypes : List [ str ] = None , metas : List [ Dict ] = None , author = None , ) : _author = author or self . author updaters = [ 'author = :author' ] values : Dict [ str , List [ Any ] ] = { 'pid' : participant_ids , 'author' : [ _author ] * len ( participant_ids ) , } if reported_sexes : updaters . append ( 'reported_sex = :reported_sex' ) values [ 'reported_sex' ] = reported_sexes if reported_genders : updaters . append ( 'reported_gender = :reported_gender' ) values [ 'reported_gender' ] = reported_genders if karyotypes : updaters . append ( 'karyotype = :karyotype' ) values [ 'karyotype' ] = karyotypes if metas : updaters . append ( 'meta = JSON_MERGE_PATCH(COALESCE(meta, "{}"), :meta' ) values [ 'meta' ] = metas keys = list ( values . keys ( ) ) list_values = [ { k : l [ idx ] for k , l in values . items ( ) } for idx in range ( len ( values [ keys [ 0 ] ] ) ) ] updaters_str = ', ' . join ( updaters ) _query = f'UPDATE participant SET {updaters_str} WHERE id = :pid' await self . connection . execute_many ( _query , list_values )
Update many participants, expects that all lists contain the same number of values.
Update many participants expects that all lists contain the same number of values .
"""
        Update many participants, expects that all lists contain the same number of values.
        You can't update selective fields on selective samples, if you provide metas, this
        function will update EVERY participant with the provided meta values.
        """
self
participant_ids
List[int]
reported_sexes
List[int]
reported_genders
List[str]
karyotypes
List[str]
metas
List[Dict]
author