Пример #1
0
def create_data(url_root):
	gateway = urljoin(url_root, 'router/')

	transaction.enter_transaction_management()

	doctor = User()
	doctor.mcid = mcid_generator.next_mcid()
	doctor.first_name = 'Demo'
	doctor.last_name = 'Doctor'
	doctor.email = '*****@*****.**'
	doctor.updatetime = 0
	doctor.ccrlogupdatetime = 0
	doctor.save()

	physician = User()
	physician.mcid = mcid_generator.next_mcid()
	physician.first_name = 'Demo'
	physician.last_name = 'Physician'
	physician.email = '*****@*****.**'
	physician.updatetime = 0
	physician.ccrlogupdatetime = 0
	physician.save()

	g, p = create_group('Demo Group Worklist',
			    '*****@*****.**', url_root,
			    doctor.mcid)

	add_to_group(g, physician.mcid)

	patients = []
	for first_name, last_name, email, currentccr, reason, ccrs in PATIENTS:
		user = User()
		user.first_name = first_name
		user.last_name = last_name
		user.email = email
		user.mcid = mcid_generator.next_mcid()
		user.acctype = 'USER'
		user.rolehack = 'ccrlhm'
		user.updatetime = 0
		user.ccrlogupdatetime = 0
		user.save()

		patients.append(user)

		# Set worklist
		sql_execute(ACCOUNT_RLS_SQL, user.mcid, p.practiceRlsUrl)

		if not currentccr:
			continue

		sql_execute(DOCUMENT_TYPE_SQL, user.mcid, currentccr)

		ev = Practiceccrevent()
		ev.practiceid = p
		ev.PatientGivenName = user.first_name
		ev.PatientFamilyName = user.last_name
		ev.PatientIdentifier = user.mcid
		ev.PatientIdentifierSource = 'Patient Medcommons ID'
		ev.Guid = currentccr
		ev.Purpose = reason
		ev.SenderProviderId = 'idp'
		ev.ReceiverProviderId = 'idp'
		ev.DOB = '16 Jan 1968 05:00:00 GMT'
		ev.CXPServerURL = ''
		ev.CXPServerVendor = 'Medcommons'
		ev.ViewerURL = urljoin(gateway, 'access?g=%s' % currentccr)
		ev.Comment = '\n            3D Imaging Consult\n            '
		ev.CreationDateTime = 1162365858
		ev.ConfirmationCode = tn_generator.next_tracking_number()
		ev.RegistrySecret = ''
		ev.PatientSex = 'Female'
		ev.PatientAge = ''
		ev.Status = 'New'
		ev.ViewStatus = 'Visible'
		ev.save()

		sql_execute(CCRLOG_SQL, user.mcid, currentccr, 'CCR',
			    ev.ConfirmationCode)

		for ccr in ccrs:
			sql_execute(CCRLOG_SQL, user.mcid, ccr, 'CCR',
				    tn_generator.next_tracking_number())

	sql_execute(TODIR_SQL, g.groupinstanceid, doctor.email,
		    doctor.email, doctor.mcid)

	sql_execute(TODIR_SQL, g.groupinstanceid, physician.email,
		    physician.email, physician.mcid)

	demoCCR = 'fdfbbb9cf53f8577b420ed72567cd2104589fb0d'

	sql_execute(CCRLOG_SQL, doctor.mcid, demoCCR, 'DICOM Import',
		    tn_generator.next_tracking_number())

	sql_execute(CCRLOG_SQL, patients[0].mcid, demoCCR, 'DICOM Import',
		    tn_generator.next_tracking_number())

	sql_execute(CCRLOG_SQL, patients[0].mcid, PATIENTS[0][3],
		    'DICOM Import',
		    tn_generator.next_tracking_number())


	# Secondary group
	if 0:
		g2, p2 = create_group('Healthy Doctors',
				      '*****@*****.**',
				      url_root, doctor.mcid)

	p = MCProperty()
	p.property = 'acDemoDoctor'
	p.value = doctor.mcid
	p.save()

	transaction.leave_transaction_management()
Пример #2
0
def create_data(url_root):
    gateway = urljoin(url_root, 'router/')

    transaction.enter_transaction_management()

    doctor = User()
    doctor.mcid = mcid_generator.next_mcid()
    doctor.first_name = 'Demo'
    doctor.last_name = 'Doctor'
    doctor.email = '*****@*****.**'
    doctor.updatetime = 0
    doctor.ccrlogupdatetime = 0
    doctor.save()

    physician = User()
    physician.mcid = mcid_generator.next_mcid()
    physician.first_name = 'Demo'
    physician.last_name = 'Physician'
    physician.email = '*****@*****.**'
    physician.updatetime = 0
    physician.ccrlogupdatetime = 0
    physician.save()

    g, p = create_group('Demo Group Worklist',
                        '*****@*****.**', url_root,
                        doctor.mcid)

    add_to_group(g, physician.mcid)

    patients = []
    for first_name, last_name, email, currentccr, reason, ccrs in PATIENTS:
        user = User()
        user.first_name = first_name
        user.last_name = last_name
        user.email = email
        user.mcid = mcid_generator.next_mcid()
        user.acctype = 'USER'
        user.rolehack = 'ccrlhm'
        user.updatetime = 0
        user.ccrlogupdatetime = 0
        user.save()

        patients.append(user)

        # Set worklist
        sql_execute(ACCOUNT_RLS_SQL, user.mcid, p.practiceRlsUrl)

        if not currentccr:
            continue

        sql_execute(DOCUMENT_TYPE_SQL, user.mcid, currentccr)

        ev = Practiceccrevent()
        ev.practiceid = p
        ev.PatientGivenName = user.first_name
        ev.PatientFamilyName = user.last_name
        ev.PatientIdentifier = user.mcid
        ev.PatientIdentifierSource = 'Patient Medcommons ID'
        ev.Guid = currentccr
        ev.Purpose = reason
        ev.SenderProviderId = 'idp'
        ev.ReceiverProviderId = 'idp'
        ev.DOB = '16 Jan 1968 05:00:00 GMT'
        ev.CXPServerURL = ''
        ev.CXPServerVendor = 'Medcommons'
        ev.ViewerURL = urljoin(gateway, 'access?g=%s' % currentccr)
        ev.Comment = '\n            3D Imaging Consult\n            '
        ev.CreationDateTime = 1162365858
        ev.ConfirmationCode = tn_generator.next_tracking_number()
        ev.RegistrySecret = ''
        ev.PatientSex = 'Female'
        ev.PatientAge = ''
        ev.Status = 'New'
        ev.ViewStatus = 'Visible'
        ev.save()

        sql_execute(CCRLOG_SQL, user.mcid, currentccr, 'CCR',
                    ev.ConfirmationCode)

        for ccr in ccrs:
            sql_execute(CCRLOG_SQL, user.mcid, ccr, 'CCR',
                        tn_generator.next_tracking_number())

    sql_execute(TODIR_SQL, g.groupinstanceid, doctor.email, doctor.email,
                doctor.mcid)

    sql_execute(TODIR_SQL, g.groupinstanceid, physician.email, physician.email,
                physician.mcid)

    demoCCR = 'fdfbbb9cf53f8577b420ed72567cd2104589fb0d'

    sql_execute(CCRLOG_SQL, doctor.mcid, demoCCR, 'DICOM Import',
                tn_generator.next_tracking_number())

    sql_execute(CCRLOG_SQL, patients[0].mcid, demoCCR, 'DICOM Import',
                tn_generator.next_tracking_number())

    sql_execute(CCRLOG_SQL, patients[0].mcid, PATIENTS[0][3], 'DICOM Import',
                tn_generator.next_tracking_number())

    # Secondary group
    if 0:
        g2, p2 = create_group('Healthy Doctors',
                              '*****@*****.**', url_root,
                              doctor.mcid)

    p = MCProperty()
    p.property = 'acDemoDoctor'
    p.value = doctor.mcid
    p.save()

    transaction.leave_transaction_management()
Пример #3
0
def save_property(key, value):
    c = MCProperty()
    c.property = 'ac' + key
    c.value = value
    c.save()
Пример #4
0
def save_property(key, value):
    c = MCProperty()
    c.property = 'ac' + key
    c.value = value
    c.save()