@@ -6,6 +6,8 @@ Medication sig parser.
66
77Instructions for Linux:
88
9+ Clone repo and cd into ` parserx ` directory.
10+
911Create virutal environment
1012
1113```
@@ -29,66 +31,55 @@ Info on MySQLClient: https://pypi.org/project/mysqlclient/
2931
3032Gunicorn/Nginx: https://realpython.com/django-nginx-gunicorn/#replacing-wsgiserver-with-gunicorn
3133
34+ Inital setup of MySQL
35+
36+ ```
37+ sudo mysql_secure_installation
38+ ```
39+
40+ Follow prompts to create root user password and accept default settings.
41+
3242```
3343sudo mysql
34- ALTER USER 'root '@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword ';
44+ CREATE USER 'parserx '@'localhost' IDENTIFIED BY 'P@ssw0rd ';
3545GRANT ALL PRIVILEGES ON parserx.* TO 'parserx'@'localhost' WITH GRANT OPTION;
46+ quit
3647```
3748
38- Terminal
49+ (back in terminal)
3950
4051```
4152mysql -u parserx -p
42- <enter password>
43- drop database parserx;
53+ <enter password = P@ssw0rd >
54+ drop database if exists parserx;
4455create database parserx;
4556quit
57+ ```
58+
59+ (back in terminal)
60+
61+ ```
4662source venv/bin/activate
4763python manage.py makemigrations
4864python manage.py makemigrations sig
4965python manage.py migrate
5066python manage.py createsuperuser
5167<follow createsuperuser prompts>
52- python manage.py runserver 0.0.0.0 :8000
68+ python manage.py runserver localhost :8000
5369```
5470
55- Postman
56-
57- 1.) Authenticate with superuser
58- POST localhost:8000/auth/token/login/
59- Headers
60- Content-Type application/json
61- Body
62- {
63- "username": "jrlegrand",
64- "password": "<password >"
65- }
66- Response
67- {
68- "auth_token": "<auth token >"
69- }
70-
71- 2.) Run ParseRx on csv file via API
72- POST localhost:8000/csv_sig/
73- Headers
74- Content-Type application/json
75- Authorization Token <auth token >
76-
77- NOTE: to change the csv file that the API runs:
78- - Go to parserx/sig/views
79- - Edit filepath in the create method of CsvSigCreateViewSet
80- - The csv file is stored in parserx/parsers/csv
81-
8271
8372## Authenticate and parse a sig via the API
8473
74+ Recommend using Postman
75+
85761.) Authenticate with user
8677POST localhost:8000/auth/token/login/
8778Headers
8879Content-Type application/json
8980Body
9081{
91- "username": "<username >",
82+ "username": "<superuser username >",
9283 "password": "<password >"
9384}
9485Response
@@ -101,10 +92,19 @@ POST localhost:8000/sig/
10192Headers
10293Content-Type application/json
10394Authorization Token <auth token >
95+ Body
96+ {
97+ "sig_text": "take 1-2 tabs po qid prn anxiety x7d"
98+ }
10499
105100
106101## Parsing / reparsing an entire CSV of sigs
107102
103+ NOTE: to change the csv file that the API runs:
104+ - Go to parserx/sig/views
105+ - Edit filepath in the create method of CsvSigCreateViewSet
106+ - The csv file is stored in parserx/parsers/csv
107+
108108Edit the name of the csv file in parserx.io/sig/views.py to be the csv you want to parse.
109109*** NOTE: ensure you have converted it to just one column full of sigs with no header.
110110
@@ -116,7 +116,7 @@ Headers
116116Content-Type application/json
117117Body
118118{
119- "username": "<username >",
119+ "username": "<superuser username >",
120120 "password": "<password >"
121121}
122122Response
@@ -133,13 +133,15 @@ Authorization Token <auth token>
133133
134134## Submiting batch sig reviews to ParseRx via API (feedback loop)
135135
136+ This would be for a "customer" that is receiving parsed sigs and wants to send back some feedback as a batch every night via the API.
137+
1361381.) Get auth token from ParseRx
137139POST api.parserx.io/auth/token/login/
138140Headers
139141Content-Type application/json
140142Body
141143{
142- "username": "<username >",
144+ "username": "<customer username >",
143145 "password": "<password >"
144146}
145147Response
0 commit comments