(importer_id)
Poll remote API and import resources as CommCare cases.

    ServiceRequest resources are treated specially for workflows that
    handle referrals across systems like CommCare.
Poll remote API and import resources as CommCare cases.
Poll remote API and import resources as CommCare cases .
def run_importer(importer_id):
    """
    Poll remote API and import resources as CommCare cases.

    ServiceRequest resources are treated specially for workflows that
    handle referrals across systems like CommCare.
    """
    importer = (
        FHIRImportConfig.objects
        .select_related('connection_settings')
        .get(pk=importer_id)
    )
    if not toggles.FHIR_INTEGRATION.enabled(importer.domain):
        return
    requests = importer.connection_settings.get_requests()
    # TODO: Check service is online, else retry with exponential backoff
    child_cases = []
    for resource_type in (
            importer.resource_types
            .filter(import_related_only=False)
            .prefetch_related('jsonpaths_to_related_resource_types')
            .all()
    ):
        import_resource_type(requests, resource_type, child_cases)
    create_parent_indices(importer, child_cases)
def run_importer ( importer_id ) : importer = ( FHIRImportConfig . objects . select_related ( 'connection_settings' ) . get ( pk = importer_id ) ) if not toggles . FHIR_INTEGRATION . enabled ( importer . domain ) : return requests = importer . connection_settings . get_requests ( ) # TODO: Check service is online, else retry with exponential backoff child_cases = [ ] for resource_type in ( importer . resource_types . filter ( import_related_only = False ) . prefetch_related ( 'jsonpaths_to_related_resource_types' ) . all ( ) ) : import_resource_type ( requests , resource_type , child_cases ) create_parent_indices ( importer , child_cases )