def CreatePatientLink(tenant_name, tenant_id):
    now = datetime.utcnow()
    timestamp_now = time.mktime(now.timetuple()) + now.microsecond * 1e-6
    timestamp_str = str(timestamp_now).rsplit('.', 1)[1]
    space_name = tenant_name.replace(" ", "_") + "_" + timestamp_str
    coSpace_id = CMS.createSpace(space_name, tenant_id)
    link, callId, ownerJid = CMS.getCoSpaceDetails(coSpace_id)
    CMS.createAccessMethod(coSpace_id, callId, space_name)
    return link
def patient():
    session['logo'] = Config.LOGO
    tenant_list = CMS.getTenants()
    form = VWR_Admin()
    form.tenants.choices = tenant_list
    if request.method == 'POST':
        tenant_id = request.form['tenants']
        tenant_name = dict(form.tenants.choices).get(form.tenants.data)
        now = datetime.utcnow()
        timestamp_now = time.mktime(now.timetuple()) + now.microsecond * 1e-6
        timestamp_str = str(timestamp_now).rsplit('.', 1)[1]
        space_name = tenant_name.replace(" ", "_") + "_" + timestamp_str
        coSpace_id = CMS.createSpace(space_name, tenant_id)
        link, callId, ownerJid = CMS.getCoSpaceDetails(coSpace_id)
        CMS.createAccessMethod(coSpace_id, callId, space_name)
        return redirect(link)
    elif request.method == 'GET':
        return render_template('index.html', form=form)