コード例 #1
0
def __format_episode_as_timeline_xml(episode, patient):
	data = {
		'category': _('Episodes'),
		'start': format_pydt(episode.best_guess_clinical_start_date),
		'container_id': gmTools.coalesce (
			value2test = episode['pk_health_issue'],
			return_instead = '',
			template4value = '(%s)'
		),
		'label': gmTools.xml_escape_string (
			gmTools.shorten_words_in_line(text = episode['description'], max_length = 20, min_word_length = 5)
		),
		'ends2day': gmTools.bool2subst(episode['episode_open'], 'True', 'False'),
		'progress': gmTools.bool2subst(episode['episode_open'], '0', '100'),
		'desc': gmTools.xml_escape_string(episode.format (
			patient = patient,
			with_summary = True,
			with_codes = True,
			with_encounters = True,
			with_documents = False,
			with_hospital_stays = False,
			with_procedures = False,
			with_family_history = False,
			with_tests = False,
			with_vaccinations = False,
			with_health_issue = True
		).strip().strip('\n').strip())
	}
	end = episode.best_guess_clinical_end_date
	if end is None:
		data['end'] = format_pydt(now)
	else:
		data['end'] = format_pydt(end)
	return __xml_episode_template % data
コード例 #2
0
ファイル: gmTimelineExporter.py プロジェクト: ncqgm/gnumed
def __format_episode_as_timeline_xml(episode, patient):
	data = {
		'category': _('Episodes'),
		'start': format_pydt(episode.best_guess_clinical_start_date),
		'container_id': gmTools.coalesce(episode['pk_health_issue'], '', '(%s)'),
		'label': gmTools.xml_escape_string (
			gmTools.shorten_words_in_line(text = episode['description'], max_length = 20, min_word_length = 5)
		),
		'ends2day': gmTools.bool2subst(episode['episode_open'], 'True', 'False'),
		'progress': gmTools.bool2subst(episode['episode_open'], '0', '100'),
		'desc': gmTools.xml_escape_string(episode.format (
			patient = patient,
			with_summary = True,
			with_codes = True,
			with_encounters = True,
			with_documents = False,
			with_hospital_stays = False,
			with_procedures = False,
			with_family_history = False,
			with_tests = False,
			with_vaccinations = False,
			with_health_issue = True
		).strip().strip('\n').strip())
	}
	end = episode.best_guess_clinical_end_date
	if end is None:
		data['end'] = format_pydt(now)
	else:
		data['end'] = format_pydt(end)
	return __xml_episode_template % data
コード例 #3
0
def __format_document_as_timeline_xml(doc):
    desc = gmTools.shorten_words_in_line(text=doc['l10n_type'],
                                         max_length=20,
                                         min_word_length=5)
    return __xml_document_template % (
        format_pydt(doc['clin_when']), format_pydt(
            doc['clin_when']), gmTools.xml_escape_string(desc), _('Documents'),
        gmTools.xml_escape_string(doc.format().strip().strip('\n').strip()))
コード例 #4
0
ファイル: gmTimelineExporter.py プロジェクト: ncqgm/gnumed
def __format_document_as_timeline_xml(doc):
	desc = gmTools.shorten_words_in_line(text = doc['l10n_type'], max_length = 20, min_word_length = 5)
	return __xml_document_template % (
		format_pydt(doc['clin_when']),
		format_pydt(doc['clin_when']),
		gmTools.xml_escape_string(desc),
		_('Documents'),
		gmTools.xml_escape_string(doc.format().strip().strip('\n').strip())
	)
コード例 #5
0
def __format_health_issue_as_timeline_xml(issue, patient, emr):
    # container IDs are supposed to be numeric
    # [email protected]
    data = {'category': _('Health issues')}
    possible_start = issue.possible_start_date
    safe_start = issue.safe_start_date
    end = issue.clinical_end_date
    ends_today = 'False'
    if end is None:
        # open episode or active
        ends_today = 'True'
        end = now
    # somewhat hacky and not really correct:
    start2use = safe_start
    if safe_start > end:
        if possible_start < end:
            start2use = possible_start
        else:
            start2use = end
    data['desc'] = gmTools.xml_escape_string(
        issue.format(patient=patient,
                     with_summary=True,
                     with_codes=True,
                     with_episodes=True,
                     with_encounters=False,
                     with_medications=False,
                     with_hospital_stays=False,
                     with_procedures=False,
                     with_family_history=False,
                     with_documents=False,
                     with_tests=False,
                     with_vaccinations=False).strip().strip('\n').strip())
    label = gmTools.shorten_words_in_line(text=issue['description'],
                                          max_length=25,
                                          min_word_length=5)
    xml = ''
    #	if possible_start < safe_start:
    #		data['start'] = format_pydt(possible_start)
    #		data['end'] = format_pydt(safe_start)
    #		data['ends2day'] = 'False'
    #		data['fuzzy'] = 'True'
    #		data['container_id'] = ''
    #		data['label'] = '?%s?' % gmTools.xml_escape_string(label)
    #		xml += __xml_issue_template % data
    data['start'] = format_pydt(start2use)
    data['end'] = format_pydt(end)
    data['ends2day'] = ends_today
    data['fuzzy'] = 'False'
    data['container_id'] = '[%s]' % issue['pk_health_issue']
    data['label'] = gmTools.xml_escape_string(label)
    xml += __xml_issue_template % data
    return xml
コード例 #6
0
def __format_procedure_as_timeline_xml(proc):
    if proc['is_ongoing']:
        end = now
    else:
        if proc['clin_end'] is None:
            end = proc['clin_when']
        else:
            end = proc['clin_end']
    desc = gmTools.shorten_words_in_line(text=proc['performed_procedure'],
                                         max_length=20,
                                         min_word_length=5)
    return __xml_procedure_template % (
        format_pydt(proc['clin_when']), format_pydt(end),
        gmTools.xml_escape_string(desc), _('Procedures'),
        gmTools.xml_escape_string(
            proc.format(include_episode=True,
                        include_codes=True).strip().strip('\n').strip()))
コード例 #7
0
ファイル: gmTimelineExporter.py プロジェクト: ncqgm/gnumed
def __format_health_issue_as_timeline_xml(issue, patient, emr):
	# container IDs are supposed to be numeric
	# [email protected]
	data = {'category': _('Health issues')}
	possible_start = issue.possible_start_date
	safe_start = issue.safe_start_date
	end = issue.clinical_end_date
	ends_today = 'False'
	if end is None:
		# open episode or active
		ends_today = 'True'
		end = now
	data['desc'] = gmTools.xml_escape_string(issue.format (
		patient = patient,
		with_summary = True,
		with_codes = True,
		with_episodes = True,
		with_encounters = False,
		with_medications = False,
		with_hospital_stays = False,
		with_procedures = False,
		with_family_history = False,
		with_documents = False,
		with_tests = False,
		with_vaccinations = False
	).strip().strip('\n').strip())
	label = gmTools.shorten_words_in_line(text = issue['description'], max_length = 25, min_word_length = 5)
	xml = ''
#	if possible_start < safe_start:
#		data['start'] = format_pydt(possible_start)
#		data['end'] = format_pydt(safe_start)
#		data['ends2day'] = 'False'
#		data['fuzzy'] = 'True'
#		data['container_id'] = ''
#		data['label'] = '?%s?' % gmTools.xml_escape_string(label)
#		xml += __xml_issue_template % data
	data['start'] = format_pydt(safe_start)
	data['end'] = format_pydt(end)
	data['ends2day'] = ends_today
	data['fuzzy'] = 'False'
	data['container_id'] = '[%s]' % issue['pk_health_issue']
	data['label'] = gmTools.xml_escape_string(label)
	xml += __xml_issue_template % data
	return xml
コード例 #8
0
ファイル: gmTimelineExporter.py プロジェクト: ncqgm/gnumed
def __format_procedure_as_timeline_xml(proc):
	if proc['is_ongoing']:
		end = now
	else:
		if proc['clin_end'] is None:
			end = proc['clin_when']
		else:
			end = proc['clin_end']
	desc = gmTools.shorten_words_in_line(text = proc['performed_procedure'], max_length = 20, min_word_length = 5)
	return __xml_procedure_template % (
		format_pydt(proc['clin_when']),
		format_pydt(end),
		gmTools.xml_escape_string(desc),
		_('Procedures'),
		gmTools.xml_escape_string(proc.format (
			include_episode = True,
			include_codes = True
		).strip().strip('\n').strip())
	)