FHIRType / workshop

Healthcare Provider Data API
GNU General Public License v3.0
0 stars 0 forks source link

API: Flatten data response is only taking the last one #56

Closed trentonyo closed 5 months ago

trentonyo commented 6 months ago
def search_practitioner(
        family_name: str, given_name: str, npi: str or None, resolve_references=True
):
    """
    Searches for a practitioner based on the given name, family name, and NPI.

    Parameters:
    family_name: The family name of the practitioner.
    given_name: The given name of the practitioner.
    npi: The NPI of the practitioner.

    Returns:
    A tuple containing a list of all matching practitioners and the predicted best match.
    """
    responses = []

    for client_name, client in smart_clients.items():
        print("PRAC: CLIENT NAME IS ", client_name)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# Flatten data here isn't a list, just contains the last entry

        practitioners, flattened_data = client.find_practitioner(
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            family_name, given_name, npi, resolve_references
        )

        if not practitioners:
            continue

        responses.extend(practitioners)

    return responses, flattened_data if responses else None