-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
40 lines (40 loc) · 20.9 KB
/
map.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Markmap</title>
<style>
* {
margin: 0;
padding: 0;
}
#mindmap {
display: block;
width: 100vw;
height: 100vh;
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/prism.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css">
</head>
<body>
<svg id="mindmap"></svg>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.min.js"></script><script>(r => {
setTimeout(r);
})(() => {
const {
markmap,
mm
} = window;
const toolbar = new markmap.Toolbar();
toolbar.attach(mm);
const el = toolbar.render();
el.setAttribute('style', 'position:absolute;bottom:20px;right:20px');
document.body.append(el);
})</script><script>((getMarkmap, getOptions, root, jsonOptions) => {
const markmap = getMarkmap();
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
})(() => window.markmap,null,{"type":"heading","depth":0,"payload":{"lines":[0,1]},"content":"Medical Records Python Scripts","children":[{"type":"heading","depth":1,"payload":{"lines":[6,7]},"content":"Installation","children":[{"type":"list_item","depth":2,"payload":{"lines":[8,9],"index":1},"content":"1. Make sure <a href=\"https://www.python.org/downloads/\">Python</a> version >= 3.10.1 is installed locally","children":[{"type":"list_item","depth":3,"payload":{"lines":[9,10]},"content":"This requires administrator privileges on company Four Peaks/AUUA machines"},{"type":"list_item","depth":3,"payload":{"lines":[10,11]},"content":"Contact Zack or IT support (XLCON) to install Python on another user to keep OSC user non-admin"},{"type":"list_item","depth":3,"payload":{"lines":[11,12]},"content":"Make sure Python was added to PATH env variable"}]},{"type":"list_item","depth":2,"payload":{"lines":[12,13],"index":2},"content":"2. Clone the <a href=\"https://github.com/Krovikan-Vamp/Python/\">repository</a> to the desired path"},{"type":"list_item","depth":2,"payload":{"lines":[13,14],"index":3},"content":"3. Download <a href=\"https://code.visualstudio.com/\">Visual Studio Code</a> as an administrator"},{"type":"list_item","depth":2,"payload":{"lines":[14,15],"index":4},"content":"4. Request a Service Account key from the <a href=\"https://github.com/Krovikan-Vamp\">administrator</a>","children":[{"type":"list_item","depth":3,"payload":{"lines":[15,16]},"content":"Ensure the Account key is stored in the root directory of the cloned repository."}]},{"type":"list_item","depth":2,"payload":{"lines":[16,17],"index":5},"content":"5. Obtain the <code>privKey.pem</code> from Zack as the program will not work without it, and it is used to decrypt the information input and output"},{"type":"list_item","depth":2,"payload":{"lines":[17,18],"index":6},"content":"6. Install the dependencies from the reqs file using <code>pip install -r requirements.txt</code>"}]},{"type":"heading","depth":1,"payload":{"lines":[19,20]},"content":"Using the Script","children":[{"type":"list_item","depth":2,"payload":{"lines":[21,22],"index":1},"content":"1. Open Visual Studio Code"},{"type":"list_item","depth":2,"payload":{"lines":[22,23],"index":2},"content":"2. Open the folder where the repository was cloned","children":[{"type":"list_item","depth":3,"payload":{"lines":[23,24]},"content":"<code>Ctrl + K & Ctrl + O</code>"}]},{"type":"list_item","depth":2,"payload":{"lines":[24,25],"index":3},"content":"3. Install the <a href=\"https://marketplace.visualstudio.com/items?itemName=donjayamanne.python-environment-manager\">Python extension</a> from the Marketplace"},{"type":"list_item","depth":2,"payload":{"lines":[25,26],"index":4},"content":"4. Press the <img src=\"https://user-images.githubusercontent.com/97307321/151602968-28d6eaeb-b17b-4055-b4e5-f0865c72a8e6.png\" alt=\"image\"> button in the top right to run the script within the integrated terminal"},{"type":"list_item","depth":2,"payload":{"lines":[26,27],"index":5},"content":"5. Follow the steps!"}]},{"type":"heading","depth":1,"payload":{"lines":[28,29]},"content":"Script Instructions","children":[{"type":"list_item","depth":2,"payload":{"lines":[30,31],"index":1},"content":"1. The following questions will be prompted to the user","children":[{"type":"paragraph","depth":3,"payload":{"lines":[31,33]},"content":"<img src=\"https://user-images.githubusercontent.com/97307321/151602884-4a5c52ae-afc7-4c9b-abb9-596e03dd7649.png\" alt=\"image\"> <br /><br>\n<img src=\"https://user-images.githubusercontent.com/97307321/151603137-4932240c-09af-46ea-88c4-ea063c67f32a.png\" alt=\"image\">"}]},{"type":"list_item","depth":2,"payload":{"lines":[33,34],"index":2},"content":"2. Fill out the prompted information"},{"type":"list_item","depth":2,"payload":{"lines":[34,35],"index":3},"content":"3. The script will do the following","children":[{"type":"list_item","depth":3,"payload":{"lines":[35,36]},"content":"Fill out the selected word docs queried by the <a href=\"https://user-images.githubusercontent.com/97307321/151602884-4a5c52ae-afc7-4c9b-abb9-596e03dd7649.png\">first question</a>"},{"type":"list_item","depth":3,"payload":{"lines":[36,37]},"content":"Create PDF files out of the documents edited using <a href=\"https://pypi.org/project/py2pdf/\">Py2PDF</a>"},{"type":"list_item","depth":3,"payload":{"lines":[37,38]},"content":"Delete created temporary files (.pdf & .docx)"},{"type":"list_item","depth":3,"payload":{"lines":[38,39]},"content":"Merges and saves the files to a single, correctly named ('Request- Last, First Med Recs Req.pdf') files using <a href=\"https://pypi.org/project/PyPDF2/\">PyPDF2</a> -> (different than Py2PDF!)"},{"type":"list_item","depth":3,"payload":{"lines":[39,40]},"content":"Writes the properties of the <code>dict</code> -> (patient information) to a new .xlsx file with the same name as the PDF using <a href=\"https://pypi.org/project/openpyxl/\">openpyxl</a>"}]}]},{"type":"heading","depth":1,"payload":{"lines":[41,42]},"content":"Features","children":[{"type":"heading","depth":2,"payload":{"lines":[45,46]},"content":"Faxing","children":[{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">def fax(patient):\n faxNo = patient["fNumber"].replace('.', '')\n # forms = ', '.join(patient["forms"])\n chromedriver_autoinstaller.install()\n driver = webdriver.Chrome(service=Service())\n driver.get('https://secure.ipfax.net/')\n # Login to the fax service\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div[1]/input').send_keys('username')\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div[2]/input').send_keys('password')\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div[4]/input').click()\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div[5]/div/input').click()\n\n # Fill out the fields\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[1]/div[1]/div/input').send_keys('Medical Records')\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[1]/div[2]/div/input').send_keys(f'{patient["ptName"]} -- {patient["forms"]}')\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[2]/div[1]/div[1]/input').send_keys(faxNo)\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[2]/div[1]/div[2]/input').click()\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[2]/div[7]/button').click()\n\n # Choose file with PyAutoGui\n sleep(2)\n pag.hotkey('ctrl', 'l')\n pag.write(f'S:\\\\')\n pag.press('enter')\n sleep(2)\n pag.press('tab', 4, 0.25)\n pag.press('down')\n pag.press('up')\n pag.press('enter')\n # Sleep to allow ipfax to process file\n sleep(2)\n\n # Send the fax\n driver.find_element(\n by=By.XPATH, value='/html/body/form[1]/div/div/div[2]/div[3]/div[1]/input').click()\n sleep(3)\n driver.close()\n</code></pre>\n"}]},{"type":"heading","depth":2,"payload":{"lines":[100,101]},"content":"Auto-Completion and Suggestions","children":[{"type":"ordered_list","depth":3,"payload":{"lines":[106,107],"startIndex":1},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[106,107],"index":1},"content":"1. The first thing to do is grab all of the data from the database to create the suggestions with the <a href=\"https://python-prompt-toolkit.readthedocs.io/en/master/index.html\">toolkit</a>."}]},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">firebase_admin.initialize_app(credentials.Certificate('./sa.json'))\ndb = firestore.client()\n\n# Create Suggestions\nraw_docs = db.collection(u'Auto Suggestions').stream()\n</code></pre>\n"},{"type":"ordered_list","depth":3,"payload":{"lines":[115,116],"startIndex":2},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[115,116],"index":2},"content":"2. Next step is aggregate the data to work with the <a href=\"https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/prompt_toolkit/completion/word_completer.py\">WordCompleter</a> function."}]},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">docs = []\nsuggestion_list = {'fax': [], 'phone': [], 'dr': [], 'procedure': [], 'surgeons': [\n 'LaTowsky', 'Mai', 'Kaplan', 'Kundavaram', 'Stern', 'Klauschie', 'Schlaifer', 'Jones', 'Wong', 'Devakumar']}\n\n# Makes the docs from Firestore usable as dicts\nfor doc in raw_docs:\n docs.append(doc.to_dict())\n\nkeys = ['fax', 'phone', 'dr', 'procedure']\nfor doc in docs:\n for key in keys:\n suggestion_list[key].append(doc[key])\n</code></pre>\n"},{"type":"ordered_list","depth":3,"payload":{"lines":[131,132],"startIndex":3},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[131,132],"index":3},"content":"3. Following the aggregation of the data, implement it in the prompts given to the user."}]},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">patient = {\n "ptName": prompt(f'What is the name of the patient?\\n'),\n "dateOfBirth": prompt(f"What is the patient's date of birth?\\n"),\n "procedureDate": prompt(f'What is the date of the procedure?\\n'),\n "procedureName": prompt(f'What is the procedure name? (i.e. PVP (Photovaporization of the prostate))\\n', completer=FuzzyCompleter(WordCompleter(suggestion_list['procedure'])), complete_in_thread=True, complete_while_typing=True),\n "anesthesiologistName": prompt(f'Who is the surgeon? (Kaplan, Wong...)\\n', completer=FuzzyCompleter(WordCompleter(suggestion_list['surgeons'])), complete_in_thread=True, complete_while_typing=True),\n "drName": prompt(f'What is the name of the doctor you are contacting? (Name only! No "Dr." needed!)\\n', completer=FuzzyCompleter(WordCompleter(suggestion_list['dr'])), complete_in_thread=True, complete_while_typing=True),\n "pNumber": prompt(f'What is the phone number of the facility you are faxing?\\n', completer=FuzzyCompleter(WordCompleter(suggestion_list['phone'])), complete_in_thread=True, complete_while_typing=True),\n "fNumber": prompt(f'What is the number you are faxing to?\\n', completer=FuzzyCompleter(WordCompleter(suggestion_list['fax'])), complete_in_thread=True, complete_while_typing=True),\n "forms": og_prompt["docs"],\n "dateOfFax": dt.today().strftime("%B %d, %Y"),\n "numberOfPages": str(len(docs)),\n "urgency": 'URGENT',\n "yourName": 'Names',\n}\n</code></pre>\n"},{"type":"bullet_list","depth":3,"payload":{"lines":[149,151]},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[149,150]},"content":"<code>FuzzyCompleter</code> is used to allow the typing of for example 8835 and the suggestions to populate with everything containing 8835... Such as (623 876 8835, 623 883 5824)"}]},{"type":"ordered_list","depth":3,"payload":{"lines":[151,153],"startIndex":4},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[151,152],"index":4},"content":"4. The new suggestions will populate like this"}]},{"type":"ordered_list","depth":3,"payload":{"lines":[156,158],"startIndex":5},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[156,157],"index":5},"content":"5. The 5th and final step is the new suggestions to the database to further improve the suggestions"}]},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">new_info = {'fax': patient['fNumber'], 'phone': patient['pNumber'],\n 'dr': patient['drName'], 'procedure': patient['procedureName']}\ndb.collection('Auto Suggestions').document().set(new_info)\n</code></pre>\n"}]},{"type":"heading","depth":2,"payload":{"lines":[164,165]},"content":"Speckles' Personality","children":[{"type":"ordered_list","depth":3,"payload":{"lines":[168,178],"startIndex":1},"content":"","children":[{"type":"list_item","depth":4,"payload":{"lines":[168,169],"index":1},"content":"1. Speckles, the Meteorologist 📡","children":[{"type":"list_item","depth":5,"payload":{"lines":[169,170]},"content":"Provides real-time weather data from <a href=\"https://api.openweathermap.org/data/2.5/\">OpenWeather API</a>"},{"type":"list_item","depth":5,"payload":{"lines":[170,171]},"content":"Real-feel, cloud cover, rain chance, etc..."}]},{"type":"list_item","depth":4,"payload":{"lines":[171,172],"index":2},"content":"2. Speckles, the Kanye Enthusiast 🎵","children":[{"type":"list_item","depth":5,"payload":{"lines":[172,173]},"content":"Gives the user random Ye quotes from <a href=\"https://api.kanye.rest/\">Kanye Rest API</a>. Shoutout to the devs of this API, what a gem! @ajzbc on Twitter."}]},{"type":"list_item","depth":4,"payload":{"lines":[173,174],"index":3},"content":"3. Speckles, the Activity Planner 🚗","children":[{"type":"list_item","depth":5,"payload":{"lines":[174,175]},"content":"Explains random activites the user can do if they're bored using <a href=\"https://www.boredapi.com/api/activity\">Bored API</a>"}]},{"type":"list_item","depth":4,"payload":{"lines":[175,176],"index":4},"content":"4. Speckles, The Philosopher 🤓","children":[{"type":"list_item","depth":5,"payload":{"lines":[176,177]},"content":"Provides the user with quotes from books in their data base... <a href=\"https://www.quotepub.com/api/widget/?type=rand\">QuotePub</a>"}]}]},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">def speckles():\n global responses\n weather_speck = json.loads(requests.get(\n 'https://api.openweathermap.org/data/2.5/weather?q=Sun City&units=imperial&appid=396b8dda92a5079f3bbf2704d32fc382').text)\n\n yeQuotes = []\n bookQuotes = []\n activities = []\n\n for n in range(5):\n # Kayne quotes\n quote = json.loads(requests.get('https://api.kanye.rest/').text)\n bQuote = json.loads(requests.get(\n 'https://www.quotepub.com/api/widget/?type=rand&limit=5').text)\n yeQuotes.append(quote['quote'])\n\n # Activities\n action = json.loads(requests.get(\n 'https://www.boredapi.com/api/activity').text)\n activities.append(\n f"With {action['participants']} person/people you can... {action['activity']}.")\n bookQuotes.append(\n f'"{bQuote[n]["quote_body"]} - {bQuote[n]["quote_author"]}"')\n\n responses = [{\n 'name': 'Speckles, the Meteorologist 📡',\n 'prompts': ['<p style="text-align: center; padding: 10px;">🐍 - "Good morning, welcome to the Speckles weather channel!" 😎 </p> ', f'<p style="text-align: center; padding: 10px;">Today is 📅 {dt.today().strftime("%B %d, %Y")} 🐍 - "When is the next holiday again?"</p>', f"<p style='text-align: center; padding: 10px;'>It's feeling like {weather_speck['main']['feels_like']}°F 🐍 - 'Always too damn hot'</p> ", f"The clouds cover {weather_speck['clouds']['all']}% of the sky ☁️ 🐍 - 'Wish it was more...'", f"Get ready for a daily high of: {weather_speck['main']['temp_max']}°F 🤠 'Yee haw'"]\n }, {\n 'name': 'Speckles, the Kanye Enthusiast 🎵 ',\n 'prompts': yeQuotes\n }, {\n 'name': 'Speckles, the Activity Planner 🚗 ',\n 'prompts': activities\n }, {\n 'name': 'Speckles, The Philosopher 🤓',\n 'prompts': bookQuotes\n }]\n</code></pre>\n"},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">def main():\n speck_time = random.choice(responses)\n</code></pre>\n"},{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">\n"procedureName": prompt(f'What is the procedure name? (i.e. PVP (Photovaporization of the prostate)) 🔪\\n', bottom_toolbar=HTML(speck_time["prompts"][0]), completer=FuzzyCompleter(WordCompleter(suggestion_list['procedure'])), complete_in_thread=True, complete_while_typing=True),\n"anesthesiologistName": prompt(f'Who is the surgeon? (Kaplan, Wong...) 🩺\\n', bottom_toolbar=HTML(speck_time["prompts"][1]), completer=FuzzyCompleter(WordCompleter(suggestion_list['surgeons'])), complete_in_thread=True, complete_while_typing=True),\n"drName": prompt(f'What is the name of the doctor you are contacting? (Name only! No "Dr." needed!)\\n', bottom_toolbar=HTML(speck_time["prompts"][2]), completer=FuzzyCompleter(WordCompleter(suggestion_list['dr'])), complete_in_thread=True, complete_while_typing=True),\n"pNumber": prompt(f'What is the phone number of the facility you are faxing? 📞\\n', bottom_toolbar=HTML(speck_time["prompts"][3]), completer=FuzzyCompleter(WordCompleter(suggestion_list['phone'])), complete_in_thread=True, complete_while_typing=True),\n"fNumber": prompt(f'What is the number you are faxing to? 📠\\n', bottom_toolbar=HTML(speck_time["prompts"][4]), completer=FuzzyCompleter(WordCompleter(suggestion_list['fax'])), complete_in_thread=True, complete_while_typing=True),\n</code></pre>\n"}]},{"type":"heading","depth":2,"payload":{"lines":[238,239]},"content":"File Management","children":[{"type":"list_item","depth":3,"payload":{"lines":[242,243]},"content":"<code>Documents</code> selected are opened with 'docx' module (Checkbox selection) ->"},{"type":"list_item","depth":3,"payload":{"lines":[243,244]},"content":"Following the completion of the <code>patient</code>, <code>docx_replace_regx()</code> changes the placeholders of the original documents in <code>/medrecs/{filename}.docx</code> ->"},{"type":"list_item","depth":3,"payload":{"lines":[244,245]},"content":"<code>Documents</code> are <em>saved as</em> '.docx' files corresponding to their index from the selected documents array ->"},{"type":"list_item","depth":3,"payload":{"lines":[245,246]},"content":"<code>Documents</code> are changed to PDFs via <code>docx2PDF</code> module ->"},{"type":"list_item","depth":3,"payload":{"lines":[246,247]},"content":"The PDFs are merged together and saved to memory ->"},{"type":"list_item","depth":3,"payload":{"lines":[247,248]},"content":"<strong>All</strong> .docx and .pdf files are deleted ->"},{"type":"list_item","depth":3,"payload":{"lines":[248,249]},"content":"The merged request PDF is then saved to the current working directory (<code>cwd</code>)->"},{"type":"list_item","depth":3,"payload":{"lines":[249,250]},"content":"<code>file_mgmt.ps1</code> is used to move the documents to the specified directories (backup and '/SCANS') and then delete from <code>cwd</code> ->"},{"type":"list_item","depth":3,"payload":{"lines":[250,251]},"content":"A <code>.xlsx</code> file is created to be copied into the Clearance Log ✅"}]}]},{"type":"heading","depth":1,"payload":{"lines":[252,253]},"content":"Upcoming features","children":[{"type":"heading","depth":2,"payload":{"lines":[256,257]},"content":"Faxing (<em>without Selenium</em>)","children":[{"type":"fence","depth":3,"content":"<pre class=\"language-Python\"><code class=\"language-Python\">import phaxio\n\ndef faxIt(pt):\n fileFaxing = f"Request- $Last, $First Med Recs Req.pdf"\n phaxio = PhaxioApi('$apiKEY', '$apiSECRET')\n phaxio.Fax.send(\n to='$receivingNumber',\n files=fileFaxing\n )\nfaxIt(patient)\n</code></pre>\n"}]}]}]},{})</script>
</body>
</html>