(document_id, path, row_docs)
return TableConfiguration._get_sub_documents_helper(document_id, path[1:], new_docs)
Return each instance of a repeat group at the path from the given docs.
        If path is [], just return the docs

        See corehq.apps.export.tests.test_table_configuration.TableConfigurationGetRowsTest.test_get_sub_documents
        for examples

        :param path: A list of a strings
        :param docs: A list of dicts representing form submissions
        :return:
Return each instance of a repeat group at the path from the given docs.
        If path is [], just return the docs
Return each instance of a repeat group at the path from the given docs . If path is [] just return the docs
def _get_sub_documents_helper(document_id, path, row_docs):
        """
        Return each instance of a repeat group at the path from the given docs.
        If path is [], just return the docs

        See corehq.apps.export.tests.test_table_configuration.TableConfigurationGetRowsTest.test_get_sub_documents
        for examples

        :param path: A list of a strings
        :param docs: A list of dicts representing form submissions
        :return:
        """
        if len(path) == 0:
            return row_docs

        new_docs = []
        for row_doc in row_docs:
            doc = row_doc.doc
            row_index = row_doc.row
            path_name = path[0].name

            if isinstance(doc, dict):
                next_doc = doc.get(path_name, {})
            else:
                next_doc = {}
            if path[0].is_repeat:
                if type(next_doc) != list:
                    # This happens when a repeat group has a single repeat iteration
                    next_doc = [next_doc]
                new_docs.extend([
                    DocRow(row=row_index + (new_doc_index,), doc=new_doc)
                    for new_doc_index, new_doc in enumerate(next_doc)
                ])
            elif next_doc:
                new_docs.append(DocRow(row=row_index, doc=next_doc))
        return TableConfiguration._get_sub_documents_helper(document_id, path[1:], new_docs)
def _get_sub_documents_helper ( document_id , path , row_docs ) : if len ( path ) == 0 : return row_docs new_docs = [ ] for row_doc in row_docs : doc = row_doc . doc row_index = row_doc . row path_name = path [ 0 ] . name if isinstance ( doc , dict ) : next_doc = doc . get ( path_name , { } ) else : next_doc = { } if path [ 0 ] . is_repeat : if type ( next_doc ) != list : # This happens when a repeat group has a single repeat iteration next_doc = [ next_doc ] new_docs . extend ( [ DocRow ( row = row_index + ( new_doc_index , ) , doc = new_doc ) for new_doc_index , new_doc in enumerate ( next_doc ) ] ) elif next_doc : new_docs . append ( DocRow ( row = row_index , doc = next_doc ) ) return TableConfiguration . _get_sub_documents_helper ( document_id , path [ 1 : ] , new_docs )