Example #1
0
	def test_grid():
		gmPersonSearch.ask_for_patient()
		app = wx.PyWidgetTester(size = (500, 300))
#		lab_grid = cMeasurementsGrid(app.frame, -1)
#		lab_grid.patient = pat
		app.frame.Show()
		app.MainLoop()
Example #2
0
	def run_monitor():

		print("starting up backend notifications monitor")

		def monitoring_callback(*args, **kwargs):
			try:
				kwargs['originated_in_database']
				print('==> got notification from database "%s":' % kwargs['signal'])
			except KeyError:
				print('==> received signal from client: "%s"' % kwargs['signal'])
			del kwargs['signal']
			for key in kwargs.keys():
				print('    [%s]: %s' % (key, kwargs[key]))

		gmDispatcher.connect(receiver = monitoring_callback)

		listener = gmBackendListener(conn = gmPG2.get_raw_connection())
		print("listening for the following notifications:")
		print("1) unspecific:")
		for sig in listener.unspecific_notifications:
			print('   - %s' % sig)

		while True:
			pat = gmPersonSearch.ask_for_patient()
			if pat is None:
				break
			print("found patient", pat)
			gmPerson.set_active_patient(patient=pat)
			print("now waiting for notifications, hit <ENTER> to select another patient")
			raw_input()

		print("cleanup")
		listener.shutdown()

		print("shutting down backend notifications monitor")
Example #3
0
	def run_monitor():

		print("starting up backend notifications monitor")

		def monitoring_callback(*args, **kwargs):
			try:
				kwargs['originated_in_database']
				print('==> got notification from database "%s":' % kwargs['signal'])
			except KeyError:
				print('==> received signal from client: "%s"' % kwargs['signal'])
			del kwargs['signal']
			for key in kwargs.keys():
				print('    [%s]: %s' % (key, kwargs[key]))

		gmDispatcher.connect(receiver = monitoring_callback)

		listener = gmBackendListener(conn = gmPG2.get_raw_connection())
		print("listening for the following notifications:")
		print("1) unspecific:")
		for sig in listener.unspecific_notifications:
			print('   - %s' % sig)

		while True:
			pat = gmPersonSearch.ask_for_patient()
			if pat is None:
				break
			print("found patient", pat)
			gmPerson.set_active_patient(patient=pat)
			print("now waiting for notifications, hit <ENTER> to select another patient")
			raw_input()

		print("cleanup")
		listener.shutdown()

		print("shutting down backend notifications monitor")
Example #4
0
	def test_person_comms_pnl():
		pat = gmPersonSearch.ask_for_patient()
		app = wx.PyWidgetTester(size = (600, 400))
		widget = cCommChannelsManagerPnl(app.frame, -1)
		widget.identity = pat
		app.frame.Show(True)
		app.MainLoop()
Example #5
0
 def test_person_comms_pnl():
     pat = gmPersonSearch.ask_for_patient()
     app = wx.PyWidgetTester(size=(600, 400))
     widget = cCommChannelsManagerPnl(app.frame, -1)
     widget.identity = pat
     app.frame.Show(True)
     app.MainLoop()
Example #6
0
	def test_test_ea_pnl():
		pat = gmPersonSearch.ask_for_patient()
		gmPatSearchWidgets.set_active_patient(patient=pat)
		app = wx.PyWidgetTester(size = (500, 300))
#		ea = cMeasurementEditAreaPnl(app.frame, -1)
		app.frame.Show()
		app.MainLoop()
Example #7
0
	def test_select_narrative_from_episodes():
		pat = gmPersonSearch.ask_for_patient()
		set_active_patient(patient = pat)
		app = wx.PyWidgetTester(size = (200, 200))
		sels = select_narrative_from_episodes_new()
		print("selected:")
		for sel in sels:
			print(sel)
Example #8
0
 def test_select_narrative():
     pat = gmPersonSearch.ask_for_patient()
     set_active_patient(patient=pat)
     app = wx.PyWidgetTester(size=(200, 200))
     sels = select_narrative(parent=None, soap_cats=None)
     print("selected:")
     for sel in sels:
         print(sel)
Example #9
0
	def test_select_narrative():
		pat = gmPersonSearch.ask_for_patient()
		set_active_patient(patient = pat)
		app = wx.PyWidgetTester(size = (200, 200))
		sels = select_narrative(parent=None, soap_cats = None)
		print("selected:")
		for sel in sels:
			print(sel)
Example #10
0
 def test_select_narrative_from_episodes():
     pat = gmPersonSearch.ask_for_patient()
     set_active_patient(patient=pat)
     app = wx.PyWidgetTester(size=(200, 200))
     sels = select_narrative_from_episodes_new()
     print("selected:")
     for sel in sels:
         print(sel)
Example #11
0
	def test_cSoapPluginPnl():
		patient = gmPersonSearch.ask_for_patient()
		if patient is None:
			print("No patient. Exiting gracefully...")
			return
		set_active_patient(patient=patient)

		application = wx.PyWidgetTester(size=(800,500))
		soap_input = cSoapPluginPnl(application.frame, -1)
		application.frame.Show(True)
		soap_input._schedule_data_reget()
		application.MainLoop()
Example #12
0
	def test_cSoapPluginPnl():
		patient = gmPersonSearch.ask_for_patient()
		if patient is None:
			print("No patient. Exiting gracefully...")
			return
		set_active_patient(patient=patient)

		application = wx.PyWidgetTester(size=(800,500))
		soap_input = cSoapPluginPnl(application.frame, -1)
		application.frame.Show(True)
		soap_input._schedule_data_reget()
		application.MainLoop()
Example #13
0
#======================================================================
# main
#----------------------------------------------------------------------
if __name__ == "__main__":

    # 3rd party
    import wx

    # GNUmed
    from Gnumed.business import gmPersonSearch

    _log.info("starting Notebooked progress notes input plugin...")

    # obtain patient
    patient = gmPersonSearch.ask_for_patient()
    if patient is None:
        print("None patient. Exiting gracefully...")
        sys.exit(0)
    gmPatSearchWidgets.set_active_patient(patient=patient)

    # display standalone multisash progress notes input
    application = wx.wx.PyWidgetTester(size=(800, 600))
    multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(
        application.frame, -1)

    application.frame.Show(True)
    application.MainLoop()

    # clean up
    if patient is not None:
Example #14
0
def run_tool():
    tool = _cfg.get(option='--tool', source_order=[('cli', 'return')])
    if tool is None:
        # not running a tool
        return None

    if tool not in _known_tools:
        _log.error('unknown tool requested: %s', tool)
        print('GNUmed startup: Unknown tool [%s] requested.' % tool)
        print('GNUmed startup: Known tools: %s' % _known_tools)
        return -1

    print('')
    print('==============================================')
    print('Running tool: %s' % tool)
    print('----------------------------------------------')
    print('')

    if tool == 'check_enc_epi_xref':
        from Gnumed.business import gmEMRStructItems
        return gmEMRStructItems.check_fk_encounter_fk_episode_x_ref()

    if tool == 'export_pat_emr_structure':
        # setup praxis
        from Gnumed.business import gmPraxis
        praxis = gmPraxis.gmCurrentPraxisBranch(
            branch=gmPraxis.get_praxis_branches()[0])
        # get patient
        from Gnumed.business import gmPersonSearch
        pat = gmPersonSearch.ask_for_patient()
        # setup exporters
        from Gnumed.business import gmEMRStructItems
        from Gnumed.exporters import gmTimelineExporter
        from Gnumed.exporters import gmPatientExporter
        while pat is not None:
            print('patient:', pat['description_gender'])
            # as EMR structure
            fname = os.path.expanduser('~/gnumed/gm-emr_structure-%s.txt' %
                                       pat.subdir_name)
            print(
                'EMR structure:',
                gmEMRStructItems.export_emr_structure(patient=pat,
                                                      filename=fname))
            # as timeline
            fname = os.path.expanduser('~/gnumed/gm-emr-%s.timeline' %
                                       pat.subdir_name)
            try:
                print(
                    'EMR timeline:',
                    gmTimelineExporter.create_timeline_file(
                        patient=pat,
                        filename=fname,
                        include_documents=True,
                        include_vaccinations=True,
                        include_encounters=True))
            finally:
                pass
            # as journal by encounter
            exporter = gmPatientExporter.cEMRJournalExporter()
            fname = os.path.expanduser(
                '~/gnumed/gm-emr-journal_by_encounter-%s.txt' %
                pat.subdir_name)
            print(
                'EMR journal (by encounter):',
                exporter.save_to_file_by_encounter(patient=pat,
                                                   filename=fname))
            # as journal by mod time
            fname = os.path.expanduser(
                '~/gnumed/gm-emr-journal_by_mod_time-%s.txt' % pat.subdir_name)
            print(
                'EMR journal (by mod time):',
                exporter.save_to_file_by_mod_time(patient=pat, filename=fname))
            # as statistical summary
            fname = os.path.expanduser('~/gnumed/gm-emr-statistics-%s.txt' %
                                       pat.subdir_name)
            output_file = io.open(fname,
                                  mode='wt',
                                  encoding='utf8',
                                  errors='replace')
            emr = pat.emr
            output_file.write(emr.format_statistics())
            output_file.close()
            print('EMR statistics:', fname)
            # as text file
            exporter = gmPatientExporter.cEmrExport(patient=pat)
            fname = os.path.expanduser('~/gnumed/gm-emr-text_export-%s.txt' %
                                       pat.subdir_name)
            output_file = io.open(fname,
                                  mode='wt',
                                  encoding='utf8',
                                  errors='replace')
            exporter.set_output_file(output_file)
            exporter.dump_constraints()
            exporter.dump_demographic_record(True)
            exporter.dump_clinical_record()
            exporter.dump_med_docs()
            output_file.close()
            print('EMR text file:', fname)
            # another patient ?
            pat = gmPersonSearch.ask_for_patient()

        return 0

    # tool export_patient_as (vcf, gdt, ...)
    #if tool == 'export_pat_demographics':

    # should not happen (because checked against _known_tools)
    return -1
Example #15
0
# main
#----------------------------------------------------------------------
if __name__ == "__main__":

	# 3rd party
	import wx

	# GNUmed
	from Gnumed.business import gmPersonSearch
	from Gnumed.wxpython import gmSOAPWidgets

	_log.info("starting Notebooked progress notes input plugin...")

	try:
		# obtain patient
		patient = gmPersonSearch.ask_for_patient()
		if patient is None:
			print "None patient. Exiting gracefully..."
			sys.exit(0)
		gmPatSearchWidgets.set_active_patient(patient=patient)

		# display standalone multisash progress notes input
		application = wx.wx.PyWidgetTester(size = (800,600))
		multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)

		application.frame.Show(True)
		application.MainLoop()

		# clean up
		if patient is not None:
			try:
Example #16
0
def run_tool():
    """Run a console tool.

	Exit codes as per man page:
		   0: normal termination of the client
		 < 0: some error occurred while trying to run a console tool
			  -1: an unknown console tool was requested
			< -1: an error occurred while a console tool was run
		-999: hard abort of the client

	One of these needs to be returned from this function (and,
	by extension from the tool having been run, if any).
	"""
    tool = _cfg.get(option='--tool', source_order=[('cli', 'return')])
    if tool is None:
        # not running a tool
        return None

    if tool not in _known_tools:
        _log.error('unknown tool requested: %s', tool)
        print('GNUmed startup: Unknown tool [%s] requested.' % tool)
        print('GNUmed startup: Known tools: %s' % _known_tools)
        return -1

    print('')
    print('==============================================')
    print('Running tool: %s' % tool)
    print('----------------------------------------------')
    print('')

    if tool == 'generate_man_page':
        man_page_fname = os.path.abspath(os.path.join('.', 'gnumed.1'))
        man_page_file = open(man_page_fname, mode='wt', encoding='utf8')
        man_page_file.write(__doc__ % datetime.date.today().strftime('%x'))
        man_page_file.close()
        print('MAN page saved as:', man_page_fname)
        return 0

    login, creds = gmPG2.request_login_params()
    pool = gmConnectionPool.gmConnectionPool()
    pool.credentials = creds
    print('')

    if tool == 'read_all_rows_of_table':
        result = gmPG2.read_all_rows_of_table()
        if result in [None, True]:
            print('Success.')
            return 0
        print('Failed. Check the log for details.')
        return -2

    if tool == 'check_mimetypes_in_archive':
        from Gnumed.business import gmDocuments
        return gmDocuments.check_mimetypes_in_archive()

    if tool == 'check_enc_epi_xref':
        from Gnumed.business import gmEMRStructItems
        return gmEMRStructItems.check_fk_encounter_fk_episode_x_ref()

    if tool == 'fingerprint_db':
        fname = 'db-fingerprint.txt'
        result = gmPG2.get_db_fingerprint(fname=fname, with_dump=True)
        if result == fname:
            print('Success: %s' % fname)
            return 0
        print('Failed. Check the log for details.')
        return -2

    if tool == 'export_pat_emr_structure':
        # setup praxis
        from Gnumed.business import gmPraxis
        praxis = gmPraxis.gmCurrentPraxisBranch(
            branch=gmPraxis.get_praxis_branches()[0])
        # get patient
        from Gnumed.business import gmPersonSearch
        pat = gmPersonSearch.ask_for_patient()
        # setup exporters
        from Gnumed.business import gmEMRStructItems
        from Gnumed.exporters import gmTimelineExporter
        from Gnumed.exporters import gmPatientExporter
        while pat is not None:
            print('patient:', pat.description_gender)
            # as EMR structure
            fname = os.path.expanduser('~/gnumed/gm-emr_structure-%s.txt' %
                                       pat.subdir_name)
            print(
                'EMR structure:',
                gmEMRStructItems.export_emr_structure(patient=pat,
                                                      filename=fname))
            # as timeline
            fname = os.path.expanduser('~/gnumed/gm-emr-%s.timeline' %
                                       pat.subdir_name)
            try:
                print(
                    'EMR timeline:',
                    gmTimelineExporter.create_timeline_file(
                        patient=pat,
                        filename=fname,
                        include_documents=True,
                        include_vaccinations=True,
                        include_encounters=True))
            finally:
                pass
            # as journal by encounter
            exporter = gmPatientExporter.cEMRJournalExporter()
            fname = os.path.expanduser(
                '~/gnumed/gm-emr-journal_by_encounter-%s.txt' %
                pat.subdir_name)
            print(
                'EMR journal (by encounter):',
                exporter.save_to_file_by_encounter(patient=pat,
                                                   filename=fname))
            # as journal by mod time
            fname = os.path.expanduser(
                '~/gnumed/gm-emr-journal_by_mod_time-%s.txt' % pat.subdir_name)
            print(
                'EMR journal (by mod time):',
                exporter.save_to_file_by_mod_time(patient=pat, filename=fname))
            # as statistical summary
            fname = os.path.expanduser('~/gnumed/gm-emr-statistics-%s.txt' %
                                       pat.subdir_name)
            output_file = open(fname,
                               mode='wt',
                               encoding='utf8',
                               errors='replace')
            emr = pat.emr
            output_file.write(emr.format_statistics())
            output_file.close()
            print('EMR statistics:', fname)
            # as text file
            exporter = gmPatientExporter.cEmrExport(patient=pat)
            fname = os.path.expanduser('~/gnumed/gm-emr-text_export-%s.txt' %
                                       pat.subdir_name)
            output_file = open(fname,
                               mode='wt',
                               encoding='utf8',
                               errors='replace')
            exporter.set_output_file(output_file)
            exporter.dump_constraints()
            exporter.dump_demographic_record(True)
            exporter.dump_clinical_record()
            exporter.dump_med_docs()
            output_file.close()
            print('EMR text file:', fname)
            # another patient ?
            pat = gmPersonSearch.ask_for_patient()
        return 0

    # tool export_patient_as (vcf, gdt, ...)
    #if tool == 'export_pat_demographics':

    # should not happen (because checked against _known_tools)
    return -1
Example #17
0
def run_tool():
	tool = _cfg.get(option = '--tool', source_order = [('cli', 'return')])
	if tool is None:
		# not running a tool
		return None

	if tool not in _known_tools:
		_log.error('unknown tool requested: %s', tool)
		print('GNUmed startup: Unknown tool [%s] requested.' % tool)
		print('GNUmed startup: Known tools: %s' % _known_tools)
		return -1

	print('')
	print('==============================================')
	print('Running tool: %s' % tool)
	print('----------------------------------------------')
	print('')

	if tool == 'check_enc_epi_xref':
		from Gnumed.business import gmEMRStructItems
		return gmEMRStructItems.check_fk_encounter_fk_episode_x_ref()

	if tool == 'export_pat_emr_structure':
		# setup praxis
		from Gnumed.business import gmPraxis
		praxis = gmPraxis.gmCurrentPraxisBranch(branch = gmPraxis.get_praxis_branches()[0])
		# get patient
		from Gnumed.business import gmPersonSearch
		pat = gmPersonSearch.ask_for_patient()
		# setup exporters
		from Gnumed.business import gmEMRStructItems
		from Gnumed.exporters import gmTimelineExporter
		from Gnumed.exporters import gmPatientExporter
		while pat is not None:
			print('patient:', pat['description_gender'])
			# as EMR structure
			fname = os.path.expanduser('~/gnumed/gm-emr_structure-%s.txt' % pat.subdir_name)
			print('EMR structure:', gmEMRStructItems.export_emr_structure(patient = pat, filename = fname))
			# as timeline
			fname = os.path.expanduser('~/gnumed/gm-emr-%s.timeline' % pat.subdir_name)
			try:
				print('EMR timeline:', gmTimelineExporter.create_timeline_file (
					patient = pat,
					filename = fname,
					include_documents = True,
					include_vaccinations = True,
					include_encounters = True
				))
			finally:
				pass
			# as journal by encounter
			exporter = gmPatientExporter.cEMRJournalExporter()
			fname = os.path.expanduser('~/gnumed/gm-emr-journal_by_encounter-%s.txt' % pat.subdir_name)
			print('EMR journal (by encounter):', exporter.save_to_file_by_encounter(patient = pat, filename = fname))
			# as journal by mod time
			fname = os.path.expanduser('~/gnumed/gm-emr-journal_by_mod_time-%s.txt' % pat.subdir_name)
			print('EMR journal (by mod time):', exporter.save_to_file_by_mod_time(patient = pat, filename = fname))
			# as statistical summary
			fname = os.path.expanduser('~/gnumed/gm-emr-statistics-%s.txt' % pat.subdir_name)
			output_file = io.open(fname, mode = 'wt', encoding = 'utf8', errors = 'replace')
			emr = pat.emr
			output_file.write(emr.format_statistics())
			output_file.close()
			print('EMR statistics:', fname)
			# as text file
			exporter = gmPatientExporter.cEmrExport(patient = pat)
			fname = os.path.expanduser('~/gnumed/gm-emr-text_export-%s.txt' % pat.subdir_name)
			output_file = io.open(fname, mode = 'wt', encoding = 'utf8', errors = 'replace')
			exporter.set_output_file(output_file)
			exporter.dump_constraints()
			exporter.dump_demographic_record(True)
			exporter.dump_clinical_record()
			exporter.dump_med_docs()
			output_file.close()
			print('EMR text file:', fname)
			# another patient ?
			pat = gmPersonSearch.ask_for_patient()

		return 0

	# tool export_patient_as (vcf, gdt, ...)
	#if tool == 'export_pat_demographics':

	# should not happen (because checked against _known_tools)
	return -1