Exemplo n.º 1
0
def search(request, resource_type, *args, **kwargs):
    """
    Search from Remote FHIR Server

    # Example client use in curl:
    # curl  -X GET http://127.0.0.1:8000/fhir/Practitioner/
    """

    interaction_type = 'search'

    logger.debug("Received:%s" % resource_type)

    conformance = False
    if resource_type is None:
        conformance = True
    elif resource_type.lower() == 'metadata':
        conformance = True
    elif resource_type.lower == 'conformance':
        conformance = True

    if conformance:
        return fhir_conformance(request, resource_type, *args, **kwargs)

    logger.debug("Interaction:%s. "
                 "Calling generic_read for %s" % (interaction_type,
                                                  resource_type))

    search = generic_read(request,
                          interaction_type,
                          resource_type,
                          id,
                          *args,
                          **kwargs)
    return search
Exemplo n.º 2
0
def vread(request, resource_type, id, *args, **kwargs):
    """
    Read from Remote FHIR Server

    # Example client use in curl:
    # curl  -X GET http://127.0.0.1:8000/fhir/Practitioner/1234
    """
    interaction_type = 'vread'
    vread = generic_read(request, interaction_type, resource_type, id, *args, **kwargs)
    return vread
Exemplo n.º 3
0
def vread(request, resource_type, id, *args, **kwargs):
    """
    Read from Remote FHIR Server

    # Example client use in curl:
    # curl  -X GET http://127.0.0.1:8000/fhir/Practitioner/1234
    """
    interaction_type = 'vread'
    vread = generic_read(request, interaction_type, resource_type, id, *args,
                         **kwargs)
    return vread
Exemplo n.º 4
0
def search_simple(request, resource_type):
    """Route to search FHIR Interaction"""

    if request.method == 'GET':
        # Search
        return generic_read(request, resource_type, id)
    # elif request.method == 'PUT':
    #     # update
    #     return update(request, resource_type, id)
    # elif request.method == 'DELETE':
    #     # delete
    #     return delete(request, resource_type, id)
    # else:
    # Not supported.
    msg = "HTTP method %s not supported at this URL." % (request.method)
    return kickout_400(msg)
Exemplo n.º 5
0
def oauth_history(request, resource_type, id, *args, **kwargs):
    """
    Read from Remote FHIR Server

    # Example client use in curl:
    # curl  -X GET http://127.0.0.1:8000/fhir/Practitioner/1234
    """

    interaction_type = '_history'
    history = generic_read(request,
                           interaction_type,
                           resource_type,
                           id=id,
                           via_oauth=True,
                           *args,
                           **kwargs)
    return history
Exemplo n.º 6
0
def search_simple(request, resource_type):
    """Route to search FHIR Interaction"""

    if request.method == 'GET':
        # Search
        return generic_read(request, resource_type, id)
    # elif request.method == 'PUT':
    #     # update
    #     return update(request, resource_type, id)
    # elif request.method == 'DELETE':
    #     # delete
    #     return delete(request, resource_type, id)
    # else:
    # Not supported.
    msg = "HTTP method %s not supported at this URL." % (request.method)
    logger_info.info(msg)

    return kickout_400(msg)
Exemplo n.º 7
0
def search(request, resource_type, *args, **kwargs):
    """
    Search from Remote FHIR Server

    # Example client use in curl:
    # curl  -X GET http://127.0.0.1:8000/fhir/Practitioner/
    """

    interaction_type = 'search'

    logger.debug("Received:%s" % resource_type)
    logger_debug.debug("Received:%s" % resource_type)

    conformance = False
    if resource_type is None:
        conformance = True
    elif resource_type.lower() == 'metadata':
        conformance = True
    elif resource_type.lower == 'conformance':
        conformance = True

    if conformance:
        return fhir_conformance(request, resource_type, *args, **kwargs)

    logger.debug("Interaction:%s. "
                 "Calling generic_read for %s" % (interaction_type,
                                                  resource_type))

    logger_debug.debug("Interaction:%s. "
                       "Calling generic_read for %s" % (interaction_type,
                                                        resource_type))

    search = generic_read(request,
                          interaction_type,
                          resource_type,
                          id,
                          *args,
                          **kwargs)
    return search