예제 #1
0
 def to_rdf(queryset, result_count, record=None, carenet=None):
     if not record:
         record = carenet.record
     
     graph = PatientGraph(record)
     graph.addAllergyExclusions(queryset.iterator())
     return graph.toRDF()
예제 #2
0
def smart_allergies(request, record):
  """ SMART allergy list, serialized as RDF/XML.

  A bit more complicated than the generic list view, since we have to serialize AllergyExclusions as well.

  """

  default_query_args = get_default_query_args()  
  allergies_query = FactQuery(Allergy, Allergy.filter_fields, default_query_args, record, None)
  exclusions_query = FactQuery(AllergyExclusion, AllergyExclusion.filter_fields, default_query_args, record, None)

  try:
    allergies_query.execute()
    exclusions_query.execute()
  except ValueError as e:
    return HttpResponseBadRequest(str(e))

  graph = PatientGraph(record)
  graph.addAllergyList(allergies_query.results.iterator())
  graph.addAllergyExclusions(exclusions_query.results.iterator())
  return HttpResponse(graph.toRDF(), mimetype='application/rdf+xml')
예제 #3
0
def smart_allergies(request, record):
    """ SMART allergy list, serialized as RDF/XML.
    
    A bit more complicated than the generic list view, since we have to serialize AllergyExclusions as well.
    
    """

    default_query_args = get_default_query_args()
    allergies_query = FactQuery(Allergy, Allergy.filter_fields,
                                default_query_args, record, None)
    exclusions_query = FactQuery(AllergyExclusion,
                                 AllergyExclusion.filter_fields,
                                 default_query_args, record, None)

    try:
        allergies_query.execute()
        exclusions_query.execute()
    except ValueError as e:
        return HttpResponseBadRequest(str(e))

    graph = PatientGraph(record)
    graph.addAllergyList(allergies_query.results.iterator())
    graph.addAllergyExclusions(exclusions_query.results.iterator())
    return HttpResponse(graph.toRDF(), mimetype='application/rdf+xml')