def get_info(self): encounterObservations = list(Observation.objects.filter(encounter=self.__encounter_id)) encounterObservations.sort(key=lambda observation: observation.node, cmp=alphanum) content = [] for observation in encounterObservations: if bool(observation.value_complex): resource_type = '' if(AudioResource.is_valid_observation(observation)): resource_type = 'audio' elif(VideoResource.is_valid_observation(observation)): resource_type = 'video' elif(ImageResource.is_valid_observation(observation)): resource_type = 'image' elif(ChartResource.is_valid_observation(observation)): resource_type = 'chart' content.append( { 'name': observation.concept.name, 'type': resource_type, 'date': str(observation.modified.day) +'/' + str(observation.modified.month) + '/' + str(observation.modified.year), 'id': observation.uuid } ) return content
def get_info(self): encounterObservations = list( Observation.objects.filter(encounter=self.__encounter_id)) encounterObservations.sort(key=lambda observation: observation.node, cmp=alphanum) content = [] for observation in encounterObservations: if bool(observation.value_complex): resource_type = '' if (AudioResource.is_valid_observation(observation)): resource_type = 'audio' elif (VideoResource.is_valid_observation(observation)): resource_type = 'video' elif (ImageResource.is_valid_observation(observation)): resource_type = 'image' elif (ChartResource.is_valid_observation(observation)): resource_type = 'chart' content.append({ 'name': observation.concept.name, 'type': resource_type, 'date': str(observation.modified.day) + '/' + str(observation.modified.month) + '/' + str(observation.modified.year), 'id': observation.uuid }) return content
def get_chart_thumbnail(request, chart_id): logger.info('Retrieving Chart ID: ' + chart_id) chart_resource = ChartResource(chart_id) thumb_data = chart_resource.generate_thumbnail() return HttpResponse(thumb_data, content_type='text/plain')
def get_chart(request, chart_id): logger.info('Retrieving Chart ID: ' + chart_id) chart_resource = ChartResource(chart_id) data = json.dumps(chart_resource.get_info()) return HttpResponse(data, content_type='application/json')