def newDoctorVisit(): pprint(f"Patient IDs: {get_all_patient_ids()}") pprint(f"Doctor IDs: {get_all_doctor_ids()}") pprint(f"Hospital IDs: {get_all_hospital_ids()}") pprint(f"Procedure IDs: {get_all_procedure_ids()}") description = { "Patient ID :": int(input("Patient ID")), "Doctor ID :": int(input("Doctor ID")), "Hospital ID :": int(input("Hospital ID")), "Procedure ID :": int(input("Procedure ID")), "Date & Time :": [input("Date"), input("Time")], "Reason for visit :": input("Reason for visit"), "Assessment :": input("Assessment"), "Notes :": input("Notes") } json_data = convertDataToJSON(description) uri = pinJSONtoIPFS(json_data) tx_hash = medicalhistory.functions.createnewDoctorVisit( int(description['Patient ID :']), int(description['Doctor ID :']), int(description['Hospital ID :']), int(description['Procedure ID :']), uri).transact({"from": w3.eth.accounts[0]}) receipt = w3.eth.waitForTransactionReceipt(tx_hash) return uri, receipt
def createHospital(): description = { "Date & Time :": [input("Date"), input("Time")], "Hospital Name :": input("Hospital Name"), "State :": input("State"), "City :": input("City") } json_data = convertDataToJSON(description) uri = pinJSONtoIPFS(json_data) tx_hash = medicalhistory.functions.createHospital(uri).transact( {"from": w3.eth.accounts[0]}) receipt = w3.eth.waitForTransactionReceipt(tx_hash) return uri, receipt
def createPatient(): time = input("Date of Birth"), input("Time of Birth") description = { "Patient Name :": input("Patient Name"), "Patient Gender :": input("Patient Gender"), "Doctor Name :": input("Doctor Name"), "Hospital Name :": input("Hospital Name") } json_data = convertDataToJSON(time, description) uri = pinJSONtoIPFS(json_data) tx_hash = medicalhistory.functions.createPatient(uri).transact( {"from": w3.eth.accounts[0]}) receipt = w3.eth.waitForTransactionReceipt(tx_hash) return uri, receipt
def createProcedures(): description = { "Date & Time :": [input("Date"), input("Time")], "Procedure Name :": input("Procedure Name"), "Procedure Description :": input("Procuedure Description") } json_data = convertDataToJSON(description) uri = pinJSONtoIPFS(json_data) tx_hash = medicalhistory.functions.createProcedures( description["Procedure Name :"], uri).transact({"from": w3.eth.accounts[0]}) receipt = w3.eth.waitForTransactionReceipt(tx_hash) return uri, receipt