def getFindingsByIds(api, service, findingIds):
    result = []
    record_count = 0
    query = {'filter': {'criteria': [[{'field': {'dataClassKey': 'FINDING', 'name': 'id'}, 'primitiveType': 'Integer', 'comparisonOperator': 'IN', 'values': None}]]}, 'selectedFields': [{'dataClassKey': 'FINDING', 'names': ['id', 'specimenOrgan', 'specimenOrganCode', 'specimenOrganVocabulary', 'findingIdentifier', 'finding', 'findingCode', 'findingVocabulary', 'findingType', 'severity', 'observation', 'frequency', 'dose', 'doseUnit', 'timepoint', 'timepointUnit', 'treatmentRelated', 'compoundId', 'studyId', 'createdDate', 'modifiedDate', 'sex']}], 'offset': 0, 'limit': 500}
    for offset in range(0, len(findingIds), 500):
        query['filter']['criteria'][0][0]['values'] = [{'value': findingId} for findingId in findingIds[offset:(offset + 500)]]
        r = requests.post((service.endpoint + 'query'), verify=False, headers={'Authorization': f'Bearer {api.get_token()}'}, json=query, timeout=None)
        if (r.status_code == 200):
            response = json.loads(r.text)
            for record in response['resultData']['data']:
                record['FINDING']['source'] = response['origin']
                result.append(record['FINDING'])
        elif (r.status_code == 401):
            api.reconnect()
            continue
    return result
def getFindingsByIds(api, service, findingIds):
    result = []
    record_count = 0
    query = {'filter': {'criteria': [[{'field': {'dataClassKey': 'FINDING', 'name': 'id'}, 'primitiveType': 'Integer', 'comparisonOperator': 'IN', 'values': None}]]}, 'selectedFields': [{'dataClassKey': 'FINDING', 'names': ['id', 'specimenOrgan', 'specimenOrganCode', 'specimenOrganVocabulary', 'findingIdentifier', 'finding', 'findingCode', 'findingVocabulary', 'findingType', 'severity', 'observation', 'frequency', 'dose', 'doseUnit', 'timepoint', 'timepointUnit', 'treatmentRelated', 'compoundId', 'studyId', 'createdDate', 'modifiedDate', 'sex']}], 'offset': 0, 'limit': 500}
    for offset in range(0, len(findingIds), 500):
        query['filter']['criteria'][0][0]['values'] = [{'value': findingId} for findingId in findingIds[offset:(offset + 500)]]
        r = requests.post((service.endpoint + 'query'), verify=False, headers={'Authorization': f'Bearer {api.get_token()}'}, json=query, timeout=None)
        if (r.status_code == 200):
            response = json.loads(r.text)
            for record in response['resultData']['data']:
                record['FINDING']['source'] = response['origin']
                result.append(record['FINDING'])
        elif (r.status_code == 401):
            api.reconnect()
            continue
    return result