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
示例#2
0
    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
示例#3
0
def get_image_thumbnail(request, image_id):
    logger.info('Retrieving Image Thumbnail: ' + image_id)
    image_resource = ImageResource(image_id)
    thumb_data = image_resource.generate_thumbnail()
    return HttpResponse(thumb_data, content_type='text/plain')
示例#4
0
def get_image(request, image_id):
    logger.info("Retrieving Image ID: " + image_id)
    image_resource = ImageResource(image_id)
    data = json.dumps(image_resource.get_info())
    return HttpResponse(data, content_type='application/json')
示例#5
0
def get_image_thumbnail(request, image_id):
    logger.info('Retrieving Image Thumbnail: ' + image_id)
    image_resource = ImageResource(image_id)
    thumb_data = image_resource.generate_thumbnail()
    return HttpResponse(thumb_data, content_type='text/plain')
示例#6
0
def get_image(request, image_id):
    logger.info("Retrieving Image ID: " + image_id)
    image_resource = ImageResource(image_id)
    data = json.dumps(image_resource.get_info())
    return HttpResponse(data, content_type='application/json')