def __call__(self): y = self.yaml_file tree_node = DijitTree() #Render the Nodes here.. jsondata = tree_node.to_json() return json
def __call__(self): y = self.yaml_file tree = DijitTree() #Add all the branches from the yaml json = tree.to_json() return json
def create_dijit_tree_json(tree_spec): widget = DijitTree() for node in tree_spec[TREE_NODE_NAME]: for k,v in node.iteritems(): print(v) widget.add_child_node(DijitTreeNode(v)) return widget.to_json()
def __call__(self): y = self.yaml_file tree = DijitTree() #Add all the branches from the yaml jsondata = tree.to_json() return json
def __call__(self): y = self.yaml_file icd10_pcs_tree_node = DijitTree() for node in y[self.node_name]: for k, v in node.iteritems(): c = DijitTreeNode(v) icd10_pcs_tree_node.add_child_node(c) json = icd10_pcs_tree_node.to_json() return json
def __call__(self): y = self.yaml_file icd10_tree_node = DijitTree() # print y for node in y[self.node_name]: for k, v in node.iteritems(): c = DijitTreeNode( v ) icd10_tree_node.add_child_node(c) jsondata = icd10_tree_node.to_json() return jsondata
def __call__(self): print("Calling the __call__") y = self.yaml_file tree = DijitTree() print(y) print("Dijit Tree Creation to begin... ") for node in y[self.node_name]: print("Iterating through the items") for k, v in node.iteritems(): c = DijitTreeNode( v ) tree.add_child_node(c) print("Added ,", c , " to Tree") jsondata = tree.to_json() return json
def __call__(self): print("Calling the __call__") y = self.yaml_file tree = DijitTree() print(y) print("Dijit Tree Creation to begin... ") for node in y[self.node_name]: print("Iterating through the items") for k, v in node.iteritems(): c = DijitTreeNode(v) tree.add_child_node(c) print("Added ,", c, " to Tree") jsondata = tree.to_json() return json
def patient(request): if request.method == "GET" and request.is_ajax(): tree = DijitTree() history = DijitTreeNode({"name": "History", "type": "application", "id": "HISTORY" }) medical_history = DijitTreeNode({"name": "Medical History", "type": "medical_history_module", "id": "MEDICAL_HISTORY" }) history.add_child_node(medical_history) surgical_history = DijitTreeNode({"name": "Surgical History", "type": "surgical_history_module", "id": "SURGICAL_HISTORY" }) history.add_child_node(surgical_history) family_history = DijitTreeNode({"name": "Family History", "type": "family_history_module", "id": "FAMILY_HISTORY" }) history.add_child_node(family_history) social_history = DijitTreeNode({"name": "Social History", "type": "social_history_module", "id": "SOCIAL_HISTORY" }) history.add_child_node(social_history) demographics = DijitTreeNode({"name": "Demographics", "type": "demographics_module", "id": "DEMOGRAPHICS" }) history.add_child_node(demographics) tree.add_child_node(history) medication_list = DijitTreeNode({"name" : "Medications", "type": "application", "module_type": "medication_list_module", "id" : "MEDICATIONS" }) tree.add_child_node(medication_list) preventives = DijitTreeNode({"name": "Preventives", "type": "application", "id": "PREVENTIVES" }) immunisation = DijitTreeNode({"name": "Immunisation", "type": "immunisation_module", "id": "IMMUNISATION" }) preventives.add_child_node(immunisation) tree.add_child_node(preventives) #medical_preventives = DijitTreeNode({"name": "Medical", #"type": "medical_preventives_module", #"id": "MEDICAL_PREVENTIVES" #}) #surgical_preventives = DijitTreeNode({"name": "Surgical", #"type": "surgical_preventives_module", #"id": "SURGICAL_PREVENTIVES" #}) #obs_and_gyn_preventives = DijitTreeNode({"name": "Obs & Gyn", #"type": "obs_and_gyn_preventives_module", #"id": "OBS_PREVENTIVES" #}) #admission = DijitTreeNode({"name" : "AdmissionDetails" , #"type" :"application", #"id" :"ADM" #}) #visit = DijitTreeNode({"name" : "OPD Visits" , #"type":"application", #"id":"VISIT" #}) investigation = DijitTreeNode({"name": "Investigation", "type": "application", "id": "INV" }) tree.add_child_node(investigation) imaging = DijitTreeNode({"name": "Imaging", "type": "application", "id": "IMAG" }) tree.add_child_node(imaging) procedure = DijitTreeNode({"name": "Procedures", "type": "application", "id": "PROCEDURES" }) tree.add_child_node(procedure) #calendar = DijitTreeNode({"name" : "Calendar" , #"type":"application", #"id":"CAL" #}) #media = DijitTreeNode({"name": "Media", #"type": "application", #"id": "MEDIA" #}) #documents = DijitTreeNode({"name": "Documents", #"type": "patient_documents_module", #"id": "DOCS" #}) #images = DijitTreeNode({"name": "Images", #"type": "patient_images_module", #"id": "IMAGES" #}) #coding = DijitTreeNode({"name": "Coding", #"type": "application", #"id": "CODING" #}) #icd_10 = DijitTreeNode({"name": "ICD 10", #"type": "icd10_module", #"id": "ICD_10" #}) #icd_10_pcs = DijitTreeNode({"name": "ICD 10 PC", #"type": "icd10_pcs_module", #"id": "ICD_10_PROCEDURE_CODES" #}) jsondata = tree.to_json() return HttpResponse(jsondata, content_type="application/json") else: raise Http404("Bad Request")
def visit(request, patient_id=None): if request.method == "GET" and request.is_ajax(): if patient_id: patient_id = int(patient_id) else: try: patient_id = int(request.GET.get('patient_id')) pat_obj = PatientDetail.objects.get(pk=patient_id) pat_urls = pat_obj.urls visit_obj = VisitDetail.objects.filter( patient_detail=pat_obj) prev_visit_obj = VisitDetail.objects.filter( patient_detail=pat_obj).filter(is_active=False) active_visit_obj = VisitDetail.objects.filter( patient_detail=pat_obj).filter(is_active=True) except(AttributeError, NameError, KeyError, TypeError, ValueError): raise Http404("ERROR! Bad Request Parameters") except(AttributeError, NameError, KeyError, TypeError, ValueError): raise Http404("ERROR! Requested Patient Data Does not exist") #pat_obj.generate_urls() #adm_obj = AdmissionDetail.objects.filter( #patient_detail=pat_obj) #demographics_obj = Demographics.objects.filter( #patient_detail=pat_obj) #social_history_obj = SocialHistory.objects.filter( #patient_detail=pat_obj) #family_history_obj = FamilyHistory.objects.filter( #patient_detail=pat_obj) #medical_history_obj = MedicalHistory.objects.filter( #patient_detail=pat_obj) #surgical_history_obj = SurgicalHistory.objects.filter( #patient_detail=pat_obj) #medication_list_obj = MedicationList.objects.filter( #patient_detail=pat_obj) #allergy_obj = Allergy.objects.filter( #patient_detail=pat_obj) #pat_inv_obj = VisitInv.objects.filter( #visit_detail__patient_detail=pat_obj) #pat_imaging_obj = VisitImaging.objects.filter( #visit_detail__patient_detail=pat_obj) tree = DijitTree() if pat_obj.can_add_new_visit(pat_obj): new_visit = DijitTreeNode({"name": "New OPD Visit", "type": "application", "id": "NEW_OPD_VISIT", "addUrl": pat_urls['add']['visit'] }) tree.add_child_node(new_visit) if active_visit_obj: active_visits = VisitDetail.objects.filter( patient_detail=pat_obj).filter(is_active=True) active_visits_node = DijitTreeNode( {"name": "Active Visits", "type": "application", "id": "ACTIVE_VISITS", "addUrl": None, 'editUrl': None, 'delUrl': None }) tree.add_child_node(active_visits_node) for active_visit in active_visits: av_urls = active_visit.urls av = DijitTreeNode({"name": active_visit.visit_date.date().isoformat(), "type": "active_visit", "id": "ACTIVE_VISITS_" + str(active_visit.id), "addUrl": None, 'editUrl': av_urls['edit'], 'delUrl': av_urls['del'] }) av_fu = DijitTreeNode({"name": "Add Follow-Up", "type": "visit_follow_up_add", "id": "VISIT_FOLLOW_UP_ADD_" + str(active_visit.id), "addUrl": av_urls['add']['follow_up'], }) av.add_child_node(av_fu) av_orders = DijitTreeNode({"name": "Orders", "type": "application", "id": "ACTIVE_VISIT_" + str(active_visit.id) + "_ORDERS_AND_PRESCRIPTION", "addUrl": None, }) av.add_child_node(av_orders) av_close = DijitTreeNode({"name": "Close", "type": "close_visit", "id": "VISIT_CLOSE_" + str(active_visit.id), "addUrl": active_visit.get_visit_detail_close_url(), }) av.add_child_node(av_close) active_visits_node.add_child_node(av) tree.add_child_node(active_visits_node) #av_edit = DijitTreeNode({"name" : "Edit" , #"type" : "visit", #"id" : "ACTIVE_VISIT_" + str(active_visit.id) , #"addUrl" : None, #"editUrl" : av_urls['edit'], #"deUrl" : av_urls['del'] #}) #av_diagnosis = DijitTreeNode({"name" : "Diagnosis" , #"type":"application", #"id":"DIAG" , #"addUrl": None, #}) #av_advice = DijiTreeNode({"name" : "Advice" , #"type":"advice", #"id":"ADVICE" , #"addUrl": None, #}) #av_procedure = DijitTreeNode({"name" : "Procedure" , #"type":"procedure", #"id":"PROC" , #"addUrl": None, #}) #av_calendar = DijiTreeNode({"name" : "Calendar" , #"type":"application", #"id":"CAL" , #"addUrl": None, #}) if active_visit.has_fu_visits(): fu_base = DijitTreeNode({"name": "Follow-ups", "type": "fu_visits", "id": "", "addUrl": None, "absoluteUrl": None }) fu_visit = active_visit.has_fu_visits() for fu in fu_visit: fu_node = DijitTreeNode({ "name": fu.visit_date.date().isoformat(), "type": "fu_visit", "id": "FU_VISIT_" + str(fu.id), "editUrl": fu.urls['edit'], "delUrl": fu.urls['del'] }) fu_orders = DijitTreeNode({"name": "Orders", "type": "application", "id": "FU_VISIT_" + str(fu.id) + "_ORDERS_AND_PRESCRIPTION", "addUrl": None, }) if prev_visit_obj: base_dict = {"name": "Closed Visits", "type": "application", "id": "CLOSED_VISITS", 'children': []} sub_dict = { "name": "", "type": "visit", "id": "", "editUrl": "", "delUrl": ""} for visit in prev_visit_obj: #visit.generate_urls() v_urls = visit.urls prev_v = DijitTreeNode({'name': visit.visit_date.date().isoformat() + "(" + visit.op_surgeon.__unicode__() + ")", 'id': "CLOSED_VISIT_" + unicode(visit.id), 'absoluteUrl':visit.get_absolute_url(), 'editUrl':v_urls['edit'], 'delUrl': v_urls['del']}) prev_v_orders = DijitTreeNode({"name": "Orders", "type": "application", "id": "CLOSED_VISIT_" + str(visit.id) + "_ORDERS_AND_PRESCRIPTION", "len": 1, "addUrl": None, }) if visit.has_fu_visits(): fu_visit = visit.has_fu_visits() prev_v_fu_base = DijitTreeNode({"name": "Follow-ups", "type": "fu_visits", "id": "CLOSED_FOLLOW_UP_VISITS_" + str(visit.id), "addUrl": None, "absoluteUrl": None }) for fu in fu_visit: prev_v_fu = DijitTreeNode({"name": fu.visit_date.date().isoformat(), "type": "fu_visit", "id": "CLOSED_FU_VISIT_" + str(fu.id), "editUrl": fu.urls['edit'], "delUrl": fu.urls['del'], }) prev_v_orders = DijitTreeNode({"name": "Orders", "type": "application", "id": "CLOSED_FU_VISIT_" + str(fu.id) + "_ORDERS_AND_PRESCRIPTION", "addUrl": None, }) procedure = DijitTreeNode({"name": "Procedures", "type": "application", "id": "PROC", "addUrl": None, }) history = DijitTreeNode({"name": "History", "type": "application", "id": "HISTORY", "addUrl": None, }) medication = DijitTreeNode({"name": "Medication", "type": "application", "id": "MEDICATION_LIST", "addUrl": None, }) investigation = DijitTreeNode({"name": "Investigation", "type": "application", "id": "INV", "addUrl": None, }) imaging = DijitTreeNode({"name": "Imaging", "type": "application", "id": "IMAG", "addUrl": None, }) media = DijitTreeNode({"name" : "Media" , "type":"application", "id":"MEDIA" , "addUrl": None }) documents = DijitTreeNode({"name" : "Documents" , "type":"patient_documents_module", "id":"DOCS" , "addUrl": None, }) media.add_child_node(documents) images = DijitTreeNode({"name" : "Images" , "type":"patient_images_module", "id":"IMAGES" , "addUrl": None, }) media.add_child_node(images) jsondata = tree.to_json() return HttpResponse(jsondata, content_type="application/json")
def __call__(self): y = self.yaml_file visit_tree_node = DijitTree() if not getattr(self.variables['patient'],'urls',None): self.variables['patient'].save() if self.variables['can_add_new_visit']: new_visit_yaml = y['new_visit'].copy() new_visit_yaml['ondblclick'] = self.variables['patient'].urls['add']['visit'] new_visit_yaml['onclick'] = self.variables['patient'].urls['add']['visit'] new_visit_node = DijitTreeNode(new_visit_yaml) visit_tree_node.add_child_node(new_visit_node) if self.variables['all_visits']: visit_node = DijitTreeNode(y['visits']) all_visits = self.variables['all_visits'] if self.variables['active_visits']: active_visits = self.variables['active_visits'] active_visits_node = DijitTreeNode(y['active_visits']) for active_visit in active_visits: if not getattr(active_visit,'urls',None): active_visit.save() active_visit_yaml = y['active_visit'].copy() #close_active_visit_yaml = y['close_active_visit'].copy() add_follow_up_visit_yaml = y['add_follow_up_to_active_visit'].copy() active_visit_yaml['id'] = "%s_%s" %(active_visit_yaml['id'], str(active_visit.id) ) active_visit_yaml['name'] = "%s (%s)" % (active_visit_yaml['name'], active_visit.visit_date.date().isoformat() ) active_visit_yaml['ondblclick'] = active_visit.urls['edit'] active_visit_yaml['onclick'] = active_visit.urls['edit'] #close_active_visit_yaml['id'] = "%s_%s" %(close_active_visit_yaml['id'], str(active_visit.id) ) add_follow_up_visit_yaml['id'] = "%s_%s" %(add_follow_up_visit_yaml['id'], str(active_visit.id) ) #close_active_visit_yaml['ondblclick'] = active_visit.get_visit_detail_close_url() add_follow_up_visit_yaml['ondblclick'] = active_visit.urls['add']['follow_up'] active_visit_node = DijitTreeNode(active_visit_yaml) #close_active_visit_node = DijitTreeNode(close_active_visit_yaml) #active_visit_node.add_child_node(close_active_visit_node) add_follow_up_active_visit_node = DijitTreeNode(add_follow_up_visit_yaml) active_visit_node.add_child_node(add_follow_up_active_visit_node) fu = active_visit.has_fu_visits() if fu: fu_active_visits_yaml = y['active_visits_follow_ups'].copy() fu_active_visits_yaml['id'] = "%s_%s" %(active_visit_yaml['id'], str(active_visit.id) ) active_visit_followup_visits_node = DijitTreeNode(fu_active_visits_yaml) for f in fu: if not getattr(f,'urls',None): f.save() print "*"*100 print f.urls print "*"*100 f_yaml = y['active_visit_follow_up'].copy() f_yaml['id'] = "%s_%s" %(f_yaml['id'], str(f.id) ) f_yaml['ondblclick'] = f.urls['edit'] f_yaml['onclick'] = f.urls['edit'] active_visit_followup_visit_node = DijitTreeNode(f_yaml) active_visit_followup_visits_node.add_child_node(active_visit_followup_visit_node) active_visit_node.add_child_node(active_visit_followup_visits_node) active_visits_node.add_child_node(active_visit_node) visit_node.add_child_node(active_visits_node) if self.variables['inactive_visits']: inactive_visits = self.variables['inactive_visits'] inactive_visits_node = DijitTreeNode(y['previous_visits']) visit_node.add_child_node(inactive_visits_node) for inactive_visit in inactive_visits: if not getattr(inactive_visit,'urls',None): inactive_visit.save() prev_v_yaml = y['previous_visit'].copy() prev_v_yaml['id'] = "%s_%s" %(prev_v_yaml['id'], str(inactive_visit.id) ) prev_v_yaml['name'] = "%s (%s)" %(prev_v_yaml['name'], inactive_visit.visit_date.date().isoformat() ) prev_v_yaml['onclick'] = inactive_visit.urls['edit'] prev_v_yaml['ondblclick']= inactive_visit.urls['edit'] inactive_visit_node = DijitTreeNode(prev_v_yaml) inactive_visits_node.add_child_node(inactive_visit_node) prev_fu = inactive_visit.has_fu_visits() if prev_fu: prev_fu_yaml = y['previous_visits_follow_ups'].copy() prev_fu_yaml['id'] = "%s_%s" %(prev_fu_yaml['id'], str(inactive_visit.id) ) inactive_visit_followup_visits_node = DijitTreeNode(prev_fu_yaml) inactive_visit_node.add_child_node(inactive_visit_followup_visits_node) for fu in prev_fu: if not getattr(fu,'urls',None): fu.save() fu_yaml = y['previous_visit_follow_up'].copy() fu_yaml['id'] = "%s_%s" %(fu_yaml['id'], str(fu.id) ) fu_yaml['name'] = "%s (%s)" %(fu_yaml['name'], fu.visit_date.date().isoformat() ) fu_yaml['ondblclick'] = fu.urls['edit'] fu_yaml['onclick'] = fu.urls['edit'] inactive_visit_followup_visit_node = DijitTreeNode(fu_yaml) inactive_visit_followup_visits_node.add_child_node(inactive_visit_followup_visit_node) visit_tree_node.add_child_node(visit_node) history_node = DijitTreeNode(y['history']) visit_tree_node.add_child_node(history_node) medication_list_node = DijitTreeNode(y['medications']) visit_tree_node.add_child_node(medication_list_node) preventives_node = DijitTreeNode(y['preventives']) visit_tree_node.add_child_node(preventives_node) investigation_node = DijitTreeNode(y['investigation']) visit_tree_node.add_child_node(investigation_node) imaging_node = DijitTreeNode(y['imaging']) visit_tree_node.add_child_node(imaging_node) procedures_node = DijitTreeNode(y['procedures']) visit_tree_node.add_child_node(procedures_node) jsondata = visit_tree_node.to_json() return json
def __call__(self): admission_tree_node = DijitTree() admission_node = DijitTreeNode({"name": "Admissions", "type": "application", "id": "ADMISSION" }) active_admission_node = DijitTreeNode({"name": "Active Admissions", "type": "admission_module", "id": "ACTIVE_ADMISSIONS", "module_type": "sub_module", "module_name": "admission" }) admission_node.add_child_node(active_admission_node) inactive_admission_node = DijitTreeNode({"name": "Previous Admissions", "type": "admission_module", "id": "PREVIOUS_ADMISSIONS", "module_type": "sub_module", "module_name": "admission" }) admission_node.add_child_node(inactive_admission_node) admission_tree_node.add_child_node(admission_node) history_node = DijitTreeNode({"name": "History", "type": "application", "id": "HISTORY" }) medical_history_node = DijitTreeNode({"name": "Medical History", "type": "medical_history_module", "id": "MEDICAL_HISTORY", "module_type": "sub_module", "module_name": "medical_history", "ui_layout": "standard", "widgets":['grid','button'] }) history_node.add_child_node(medical_history_node) surgical_history_node = DijitTreeNode({"name": "Surgical History", "type": "surgical_history_module", "id": "SURGICAL_HISTORY", "module_type": "sub_module", "module_name": "surgical_history", "ui_layout": "standard", "widgets":['grid','button'] }) history_node.add_child_node(surgical_history_node) family_history_node = DijitTreeNode({"name": "Family History", "type": "family_history_module", "id": "FAMILY_HISTORY", "module_type": "sub_module", "module_name": "family_history", "ui_layout": "standard", "widgets":['grid','button'] }) history_node.add_child_node(family_history_node) social_history_node = DijitTreeNode({"name": "Social History", "type": "social_history_module", "id": "SOCIAL_HISTORY", "module_type": "sub_module", "module_name": "social_history", "ui_layout": "standard", "widgets":['form'] }) history_node.add_child_node(social_history_node) contact_node = DijitTreeNode({"name": "Contact", "type": "contact_module", "id": "CONTACT", "module_type": "sub_module", "module_name": "contact", "ui_layout": "standard", "widgets":['grid','button'] }) phone_node = DijitTreeNode({"name": "Phone", "type": "phone_module", "id": "PHONE", "module_type": "sub_module", "module_name": "phone", "ui_layout": "standard", "widgets":['grid','button'] }) guardian_node = DijitTreeNode({"name": "Guardian", "type": "guardian_module", "id": "GUARDIAN", "module_type": "sub_module", "module_name": "guardian", "ui_layout": "standard", "widgets":['grid','button'] }) demographics_node = DijitTreeNode({"name": "Demographics", "type": "demographics_module", "id": "DEMOGRAPHICS", "module_type": "sub_module", "module_name": "demographics", "ui_layout": "composite", "widgets":['form'], 'linked_modules':[contact_node(),phone_node(),guardian_node()] }) #demographics_node.add_child_node(contact_node) #demographics_node.add_child_node(phone_node) #demographics_node.add_child_node(guardian_node) history_node.add_child_node(demographics_node) admission_tree_node.add_child_node(history_node) allergy_node = DijitTreeNode({"name" : "Allergy", "type": "allergy_list_module", "module_type": "sub_module", "module_name": "allergy_list", "id" : "ALLERGY", "ui_layout": "standard", "widgets":['grid','button'] }) medication_list_node = DijitTreeNode({"name" : "Medications", "type": "application", "module_type": "medication_list_module", "module_name": "medication_list", "id" : "MEDICATIONS", "ui_layout": "composite", "widgets":['grid','button'], "linked_modules":[allergy_node()] }) admission_tree_node.add_child_node(medication_list_node) preventives_node = DijitTreeNode({"name": "Preventives", "type": "application", "id": "PREVENTIVES" }) immunisation_node = DijitTreeNode({"name": "Immunisation", "type": "immunisation_module", "id": "IMMUNISATION", "module_type": "sub_module", "module_name": "immunisation", "ui_layout": "standard", "widgets":['grid','button'], }) preventives_node.add_child_node(immunisation_node) admission_tree_node.add_child_node(preventives_node) #medical_preventives_node = DijitTreeNode({"name": "Medical", #"type": "medical_preventives_module", #"id": "MEDICAL_PREVENTIVES" #}) #surgical_preventives_node = DijitTreeNode({"name": "Surgical", #"type": "surgical_preventives_module", #"id": "SURGICAL_PREVENTIVES" #}) #obs_and_gyn_preventives_node = DijitTreeNode({"name": "Obs & Gyn", #"type": "obs_and_gyn_preventives_module", #"id": "OBS_PREVENTIVES" #}) #admission_node = DijitTreeNode({"name" : "AdmissionDetails", #"type" :"application", #"id" :"ADM" #}) #visit_node = DijitTreeNode({"name" : "OPD Visits", #"type":"application", #"id":"VISIT" #}) investigation_node = DijitTreeNode({"name": "Investigation", "type": "application", "id": "INV" }) admission_tree_node.add_child_node(investigation_node) imaging_node = DijitTreeNode({"name": "Imaging", "type": "application", "id": "IMAG" }) admission_tree_node.add_child_node(imaging_node) procedure_node = DijitTreeNode({"name": "Procedures", "type": "application", "id": "PROCEDURES" }) admission_tree_node.add_child_node(procedure_node) #calendar_node = DijitTreeNode({"name" : "Calendar" , #"type":"application", #"id":"CAL" #}) #media_node = DijitTreeNode({"name": "Media", #"type": "application", #"id": "MEDIA" #}) #documents_node = DijitTreeNode({"name": "Documents", #"type": "patient_documents_module", #"id": "DOCS" #}) #images_node = DijitTreeNode({"name": "Images", #"type": "patient_images_module", #"id": "IMAGES" #}) #coding_node = DijitTreeNode({"name": "Coding", #"type": "application", #"id": "CODING" #}) #icd_10_node = DijitTreeNode({"name": "ICD 10", #"type": "icd10_module", #"id": "ICD_10" #}) #icd_10_pcs_node = DijitTreeNode({"name": "ICD 10 PC", #"type": "icd10_pcs_module", #"id": "ICD_10_PROCEDURE_CODES" #}) json = admission_tree_node.to_json() return json
def __call__(self): y = self.yaml_file patient_tree_node = DijitTree() history_node = DijitTreeNode( y['history']) preventives_node = DijitTreeNode( y['preventives']) demographics_node = DijitTreeNode( y['demographics']) medication_list_node = DijitTreeNode( y['medications']) #admission_node = DijitTreeNode( y['admissions']) visit_node= DijitTreeNode( y['visits']) # icd10_node = DijitTreeNode( y['icd_10'] ) # icd10_pcs_node = DijitTreeNode( y['icd_10_pcs'] ) # fda_drug_db_node = DijitTreeNode( y['fda_drug_db'] ) #procedure_node = DijitTreeNode( y['procedures'] ) #imaging_node = DijitTreeNode( y['imaging'] ) #investigation_node= DijitTreeNode( y['investigation'] ) patient_tree_node.add_child_node( history_node ) patient_tree_node.add_child_node( preventives_node ) patient_tree_node.add_child_node( demographics_node ) patient_tree_node.add_child_node( medication_list_node ) #patient_tree_node.add_child_node( admission_node ) patient_tree_node.add_child_node( visit_node ) # patient_tree_node.add_child_node( icd10_node ) # patient_tree_node.add_child_node( icd10_pcs_node ) # patient_tree_node.add_child_node( fda_drug_db_node ) #patient_tree_node.add_child_node( procedure_node ) #patient_tree_node.add_child_node( imaging_node ) #patient_tree_node.add_child_node( investigation_node ) jsondata = patient_tree_node.to_json() return jsondata
def __call__(self): y = self.yaml_file patient_tree_node = DijitTree() history_node = DijitTreeNode(y['history']) preventives_node = DijitTreeNode(y['preventives']) demographics_node = DijitTreeNode(y['demographics']) medication_list_node = DijitTreeNode(y['medications']) #admission_node = DijitTreeNode( y['admissions']) visit_node = DijitTreeNode(y['visits']) # icd10_node = DijitTreeNode( y['icd_10'] ) # icd10_pcs_node = DijitTreeNode( y['icd_10_pcs'] ) # fda_drug_db_node = DijitTreeNode( y['fda_drug_db'] ) #procedure_node = DijitTreeNode( y['procedures'] ) #imaging_node = DijitTreeNode( y['imaging'] ) #investigation_node= DijitTreeNode( y['investigation'] ) patient_tree_node.add_child_node(history_node) patient_tree_node.add_child_node(preventives_node) patient_tree_node.add_child_node(demographics_node) patient_tree_node.add_child_node(medication_list_node) #patient_tree_node.add_child_node( admission_node ) patient_tree_node.add_child_node(visit_node) # patient_tree_node.add_child_node( icd10_node ) # patient_tree_node.add_child_node( icd10_pcs_node ) # patient_tree_node.add_child_node( fda_drug_db_node ) #patient_tree_node.add_child_node( procedure_node ) #patient_tree_node.add_child_node( imaging_node ) #patient_tree_node.add_child_node( investigation_node ) jsondata = patient_tree_node.to_json() return jsondata
def __call__(self): y = self.yaml_file visit_tree_node = DijitTree() if not getattr(self.variables['patient'], 'urls', None): self.variables['patient'].save() if self.variables['can_add_new_visit']: new_visit_yaml = y['new_visit'].copy() new_visit_yaml['ondblclick'] = self.variables['patient'].urls[ 'add']['visit'] new_visit_yaml['onclick'] = self.variables['patient'].urls['add'][ 'visit'] new_visit_node = DijitTreeNode(new_visit_yaml) visit_tree_node.add_child_node(new_visit_node) if self.variables['all_visits']: visit_node = DijitTreeNode(y['visits']) all_visits = self.variables['all_visits'] if self.variables['active_visits']: active_visits = self.variables['active_visits'] active_visits_node = DijitTreeNode(y['active_visits']) for active_visit in active_visits: if not getattr(active_visit, 'urls', None): active_visit.save() active_visit_yaml = y['active_visit'].copy() #close_active_visit_yaml = y['close_active_visit'].copy() add_follow_up_visit_yaml = y[ 'add_follow_up_to_active_visit'].copy() active_visit_yaml['id'] = "%s_%s" % ( active_visit_yaml['id'], str(active_visit.id)) active_visit_yaml['name'] = "%s (%s)" % ( active_visit_yaml['name'], active_visit.visit_date.date().isoformat()) active_visit_yaml['ondblclick'] = active_visit.urls['edit'] active_visit_yaml['onclick'] = active_visit.urls['edit'] #close_active_visit_yaml['id'] = "%s_%s" %(close_active_visit_yaml['id'], str(active_visit.id) ) add_follow_up_visit_yaml['id'] = "%s_%s" % ( add_follow_up_visit_yaml['id'], str(active_visit.id)) #close_active_visit_yaml['ondblclick'] = active_visit.get_visit_detail_close_url() add_follow_up_visit_yaml['ondblclick'] = active_visit.urls[ 'add']['follow_up'] active_visit_node = DijitTreeNode(active_visit_yaml) #close_active_visit_node = DijitTreeNode(close_active_visit_yaml) #active_visit_node.add_child_node(close_active_visit_node) add_follow_up_active_visit_node = DijitTreeNode( add_follow_up_visit_yaml) active_visit_node.add_child_node( add_follow_up_active_visit_node) fu = active_visit.has_fu_visits() if fu: fu_active_visits_yaml = y[ 'active_visits_follow_ups'].copy() fu_active_visits_yaml['id'] = "%s_%s" % ( active_visit_yaml['id'], str(active_visit.id)) active_visit_followup_visits_node = DijitTreeNode( fu_active_visits_yaml) for f in fu: if not getattr(f, 'urls', None): f.save() print "*" * 100 print f.urls print "*" * 100 f_yaml = y['active_visit_follow_up'].copy() f_yaml['id'] = "%s_%s" % (f_yaml['id'], str(f.id)) f_yaml['ondblclick'] = f.urls['edit'] f_yaml['onclick'] = f.urls['edit'] active_visit_followup_visit_node = DijitTreeNode( f_yaml) active_visit_followup_visits_node.add_child_node( active_visit_followup_visit_node) active_visit_node.add_child_node( active_visit_followup_visits_node) active_visits_node.add_child_node(active_visit_node) visit_node.add_child_node(active_visits_node) if self.variables['inactive_visits']: inactive_visits = self.variables['inactive_visits'] inactive_visits_node = DijitTreeNode(y['previous_visits']) visit_node.add_child_node(inactive_visits_node) for inactive_visit in inactive_visits: if not getattr(inactive_visit, 'urls', None): inactive_visit.save() prev_v_yaml = y['previous_visit'].copy() prev_v_yaml['id'] = "%s_%s" % (prev_v_yaml['id'], str(inactive_visit.id)) prev_v_yaml['name'] = "%s (%s)" % ( prev_v_yaml['name'], inactive_visit.visit_date.date().isoformat()) prev_v_yaml['onclick'] = inactive_visit.urls['edit'] prev_v_yaml['ondblclick'] = inactive_visit.urls['edit'] inactive_visit_node = DijitTreeNode(prev_v_yaml) inactive_visits_node.add_child_node(inactive_visit_node) prev_fu = inactive_visit.has_fu_visits() if prev_fu: prev_fu_yaml = y['previous_visits_follow_ups'].copy() prev_fu_yaml['id'] = "%s_%s" % (prev_fu_yaml['id'], str(inactive_visit.id)) inactive_visit_followup_visits_node = DijitTreeNode( prev_fu_yaml) inactive_visit_node.add_child_node( inactive_visit_followup_visits_node) for fu in prev_fu: if not getattr(fu, 'urls', None): fu.save() fu_yaml = y['previous_visit_follow_up'].copy() fu_yaml['id'] = "%s_%s" % (fu_yaml['id'], str( fu.id)) fu_yaml['name'] = "%s (%s)" % ( fu_yaml['name'], fu.visit_date.date().isoformat()) fu_yaml['ondblclick'] = fu.urls['edit'] fu_yaml['onclick'] = fu.urls['edit'] inactive_visit_followup_visit_node = DijitTreeNode( fu_yaml) inactive_visit_followup_visits_node.add_child_node( inactive_visit_followup_visit_node) visit_tree_node.add_child_node(visit_node) history_node = DijitTreeNode(y['history']) visit_tree_node.add_child_node(history_node) medication_list_node = DijitTreeNode(y['medications']) visit_tree_node.add_child_node(medication_list_node) preventives_node = DijitTreeNode(y['preventives']) visit_tree_node.add_child_node(preventives_node) investigation_node = DijitTreeNode(y['investigation']) visit_tree_node.add_child_node(investigation_node) imaging_node = DijitTreeNode(y['imaging']) visit_tree_node.add_child_node(imaging_node) procedures_node = DijitTreeNode(y['procedures']) visit_tree_node.add_child_node(procedures_node) jsondata = visit_tree_node.to_json() return json