(
    dhis2_server: ConnectionSettings,
    period: Optional[str] = None,
    print_notifications: bool = False,
)
Update facility_supervision cases with indicators collected in DHIS2
    over the last quarter.

    :param dhis2_server: The ConnectionSettings instance to connect to
        the remote API.
    :param period: The period of data to import. e.g. "2020Q1". Defaults
        to last quarter.
    :param print_notifications: If True, notifications are printed,
        otherwise they are emailed.
Update facility_supervision cases with indicators collected in DHIS2
    over the last quarter.
Update facility_supervision cases with indicators collected in DHIS2 over the last quarter .
def execute_update_facility_cases_from_dhis2_data_elements(
    dhis2_server: ConnectionSettings,
    period: Optional[str] = None,
    print_notifications: bool = False,
):
    """
    Update facility_supervision cases with indicators collected in DHIS2
    over the last quarter.

    :param dhis2_server: The ConnectionSettings instance to connect to
        the remote API.
    :param period: The period of data to import. e.g. "2020Q1". Defaults
        to last quarter.
    :param print_notifications: If True, notifications are printed,
        otherwise they are emailed.

    """
    try:
        clays = get_clays()
        with ThreadPoolExecutor(max_workers=MAX_THREAD_WORKERS) as executor:
            futures = (executor.submit(set_case_updates,
                                       dhis2_server, clay, period)
                       for clay in clays)
            for futures_chunk in chunked(as_completed(futures), 100):
                case_blocks_chunk = [f.result() for f in futures_chunk]
                save_cases(case_blocks_chunk)
    except Exception as err:
        handle_error(err, dhis2_server, print_notifications)
    else:
        handle_success(dhis2_server, print_notifications)
def execute_update_facility_cases_from_dhis2_data_elements ( dhis2_server : ConnectionSettings , period : Optional [ str ] = None , print_notifications : bool = False , ) : try : clays = get_clays ( ) with ThreadPoolExecutor ( max_workers = MAX_THREAD_WORKERS ) as executor : futures = ( executor . submit ( set_case_updates , dhis2_server , clay , period ) for clay in clays ) for futures_chunk in chunked ( as_completed ( futures ) , 100 ) : case_blocks_chunk = [ f . result ( ) for f in futures_chunk ] save_cases ( case_blocks_chunk ) except Exception as err : handle_error ( err , dhis2_server , print_notifications ) else : handle_success ( dhis2_server , print_notifications )