Ejemplo n.º 1
0
def matrixv2_raw(context, request):
    fr = FieldedResponse(_meta={'params_parser': ParamsParser(request)},
                         response_fields=[
                             RawMatrixWithAggsResponseField(
                                 default_item_types=DEFAULT_ITEM_TYPES)
                         ])
    return fr.render()
Ejemplo n.º 2
0
def searchv2_quick(context, request):
    fr = FieldedResponse(
        _meta={'params_parser': ParamsParser(request)},
        response_fields=[
            BasicSearchResponseField(default_item_types=DEFAULT_ITEM_TYPES)
        ])
    return fr.render()
Ejemplo n.º 3
0
def audit(context, request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title=AUDIT_TITLE
            ),
            TypeResponseField(
                at_type=[AUDIT_TITLE]
            ),
            IDResponseField(),
            SearchBaseResponseField(),
            ContextResponseField(),
            AuditMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES
            ),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 4
0
def cart_search(context, request):
    '''
    Like search but takes cart params.
    '''
    # Note the order of rendering matters for some fields, e.g. AllResponseField and
    # NotificationResponseField depend on results from CartSearchWithFacetsResponseField.
    fr = FieldedResponse(_meta={'params_parser': ParamsParser(request)},
                         response_fields=[
                             TitleResponseField(title='Cart search'),
                             TypeResponseField(at_type=[SEARCH_TITLE]),
                             IDResponseField(),
                             ContextResponseField(),
                             CartSearchWithFacetsResponseField(
                                 default_item_types=DEFAULT_ITEM_TYPES,
                                 cart=CartWithElements(request),
                             ),
                             AllResponseField(),
                             NotificationResponseField(),
                             CartFiltersResponseField(),
                             ClearFiltersResponseFieldWithCarts(),
                             ColumnsResponseField(),
                             SortResponseField(),
                             DebugQueryResponseField()
                         ])
    return fr.render()
Ejemplo n.º 5
0
def search(context, request):
    # Note the order of rendering matters for some fields, e.g. AllResponseField and
    # NotificationResponseField depend on results from BasicSearchWithFacetsResponseField.
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title=SEARCH_TITLE
            ),
            TypeResponseField(
                at_type=[SEARCH_TITLE]
            ),
            IDResponseField(),
            ContextResponseField(),
            BasicSearchWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES
            ),
            AllResponseField(),
            NotificationResponseField(),
            FiltersResponseField(),
            ClearFiltersResponseField(),
            ColumnsResponseField(),
            SortResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 6
0
def summary(context, request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title=SUMMARY_TITLE
            ),
            TypeResponseField(
                at_type=[SUMMARY_TITLE]
            ),
            IDResponseField(),
            SearchBaseResponseField(),
            ContextResponseField(),
            BasicMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES,
                matrix_definition_name=SUMMARY_MATRIX
            ),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 7
0
def mouse_development(context, request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title='Mouse Development Matrix'
            ),
            TypeResponseField(
                at_type=['MouseDevelopmentMatrix']
            ),
            IDResponseField(),
            SearchBaseResponseField(),
            ContextResponseField(),
            BasicMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES,
                matrix_definition_name='mouse_development'
            ),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 8
0
def entex_matrix(context, request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title='Epigenomes from four individuals (ENTEx)'
            ),
            TypeResponseField(
                at_type=['EntexMatrix']
            ),
            IDResponseField(),
            SearchBaseResponseField(),
            ContextResponseField(),
            MissingMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES,
                matrix_definition_name='entex'
            ),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 9
0
def report(context, request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            TitleResponseField(
                title=REPORT_TITLE
            ),
            TypeResponseField(
                at_type=[REPORT_TITLE]
            ),
            IDResponseField(),
            ContextResponseField(),
            BasicReportWithFacetsResponseField(),
            AllResponseField(),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            ColumnsResponseField(),
            NonSortableResponseField(),
            SortResponseField(),
            DebugQueryResponseField()
        ]
    )
    return fr.render()
Ejemplo n.º 10
0
def test_searches_responses_fielded_response_render(dummy_request):
    from snovault.elasticsearch.searches.responses import FieldedResponse
    from snovault.elasticsearch.searches.responses import StreamedResponse
    from snovault.elasticsearch.searches.parsers import ParamsParser
    from pyramid.response import Response
    fr = FieldedResponse()
    fr.response = {'a': 1}
    response = fr.render()
    assert isinstance(response, dict)
    fr.response = {'a': (x for x in [1, 2, 3])}
    response = fr.render()
    assert isinstance(response, Response)
    assert isinstance(response.app_iter, StreamedResponse)
    assert response.json == {'a': [1, 2, 3]}
    dummy_request.__parent__ = 'something'
    fr = FieldedResponse(_meta={'params_parser': ParamsParser(dummy_request)})
    fr.response = {'a': (x for x in [1, 2, 3])}
    response = fr.render()
    assert isinstance(response, dict)
    assert response == {'a': [1, 2, 3]}
Ejemplo n.º 11
0
def collection_view_listing_es(context, request):
    if not hasattr(request,
                   'datastore') or request.datastore != ELASTIC_SEARCH:
        return collection_view_listing_db(context, request)
    fr = FieldedResponse(_meta={'params_parser': ParamsParser(request)},
                         response_fields=[
                             IDResponseField(),
                             CollectionSearchWithFacetsResponseField(),
                             AllResponseField(),
                             NotificationResponseField(),
                             FiltersResponseField(),
                             CollectionClearFiltersResponseField(),
                             ColumnsResponseField()
                         ])
    return fr.render()
Ejemplo n.º 12
0
def encore_rna_seq_matrix(context, request):
    fr = FieldedResponse(
        _meta={'params_parser': ParamsParser(request)},
        response_fields=[
            TitleResponseField(title='ENCORE RNA-seq Matrix'),
            TypeResponseField(at_type=['EncoreRnaSeqMatrix']),
            IDResponseField(),
            SearchBaseResponseField(),
            ContextResponseField(),
            MissingMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES,
                matrix_definition_name='encore_rna_seq_matrix'),
            NotificationResponseField(),
            FiltersResponseField(),
            TypeOnlyClearFiltersResponseField(),
            DebugQueryResponseField()
        ])
    return fr.render()
Ejemplo n.º 13
0
def cart_matrix(context, request):
    fr = FieldedResponse(
        _meta={'params_parser': ParamsParser(request)},
        response_fields=[
            TitleResponseField(title='Cart matrix'),
            TypeResponseField(at_type=[MATRIX_TITLE]),
            IDResponseField(),
            SearchBaseResponseField(search_base='/cart-search/'),
            ContextResponseField(),
            CartMatrixWithFacetsResponseField(
                default_item_types=DEFAULT_ITEM_TYPES,
                cart=CartWithElements(request),
            ),
            NotificationResponseField(),
            CartFiltersResponseField(),
            TypeOnlyClearFiltersResponseFieldWithCarts(),
            DebugQueryResponseField()
        ])
    return fr.render()