Skip to content

Commit c22676e

Browse files
authored
Create README.md
1 parent 0f828f1 commit c22676e

File tree

1 file changed

+151
-0
lines changed

1 file changed

+151
-0
lines changed

README.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# ParseRx
2+
Medication sig parser.
3+
4+
5+
## Getting started
6+
7+
python3 -m venv venv
8+
source venv/bin/activate
9+
pip install django
10+
pip install djangorestframework
11+
pip install "djangorestframework-api-key==2.*"
12+
pip install django-cors-headers
13+
pip install djoser
14+
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
15+
pip install mysqlclient
16+
17+
18+
## Initialize the database
19+
20+
How to initially setup MySQL: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
21+
Info on MySQLClient: https://pypi.org/project/mysqlclient/
22+
Gunicorn/Nginx: https://realpython.com/django-nginx-gunicorn/#replacing-wsgiserver-with-gunicorn
23+
24+
sudo mysql
25+
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';
26+
GRANT ALL PRIVILEGES ON parserx.* TO 'parserx'@'localhost' WITH GRANT OPTION;
27+
28+
Terminal
29+
30+
mysql -u parserx -p
31+
<enter password>
32+
drop database parserx;
33+
create database parserx;
34+
quit
35+
source venv/bin/activate
36+
python manage.py makemigrations
37+
python manage.py makemigrations sig
38+
python manage.py migrate
39+
python manage.py createsuperuser
40+
<follow createsuperuser prompts>
41+
python manage.py runserver 0.0.0.0:8000
42+
43+
Postman
44+
45+
1.) Authenticate with superuser
46+
POST localhost:8000/auth/token/login/
47+
Headers
48+
Content-Type application/json
49+
Body
50+
{
51+
"username": "jrlegrand",
52+
"password": "<password>"
53+
}
54+
Response
55+
{
56+
"auth_token": "<auth token>"
57+
}
58+
59+
2.) Run ParseRx on csv file via API
60+
POST localhost:8000/csv_sig/
61+
Headers
62+
Content-Type application/json
63+
Authorization Token <auth token>
64+
65+
NOTE: to change the csv file that the API runs:
66+
- Go to parserx/sig/views
67+
- Edit filepath in the create method of CsvSigCreateViewSet
68+
- The csv file is stored in parserx/parsers/csv
69+
70+
71+
## Authenticate and parse a sig via the API
72+
73+
1.) Authenticate with user
74+
POST localhost:8000/auth/token/login/
75+
Headers
76+
Content-Type application/json
77+
Body
78+
{
79+
"username": "<username>",
80+
"password": "<password>"
81+
}
82+
Response
83+
{
84+
"auth_token": "<auth token>"
85+
}
86+
87+
2.) Run query via API
88+
POST localhost:8000/sig/
89+
Headers
90+
Content-Type application/json
91+
Authorization Token <auth token>
92+
93+
94+
## Parsing / reparsing an entire CSV of sigs
95+
96+
Edit the name of the csv file in parserx.io/sig/views.py to be the csv you want to parse.
97+
***NOTE: ensure you have converted it to just one column full of sigs with no header.
98+
99+
Postman
100+
101+
1.) Authenticate with superuser
102+
POST localhost:8000/auth/token/login/
103+
Headers
104+
Content-Type application/json
105+
Body
106+
{
107+
"username": "<username>",
108+
"password": "<password>"
109+
}
110+
Response
111+
{
112+
"auth_token": "<auth token>"
113+
}
114+
115+
2.) Run ParseRx on csv file via API
116+
POST localhost:8000/csv_sig/
117+
Headers
118+
Content-Type application/json
119+
Authorization Token <auth token>
120+
121+
122+
## Submiting batch sig reviews to ParseRx via API (feedback loop)
123+
124+
1.) Get auth token from ParseRx
125+
POST api.parserx.io/auth/token/login/
126+
Headers
127+
Content-Type application/json
128+
Body
129+
{
130+
"username": "<username>",
131+
"password": "<password>"
132+
}
133+
Response
134+
{
135+
"auth_token": "<auth token>"
136+
}
137+
138+
2.) Sumbit batch reviews to ParseRx
139+
POST api.parserx.io/sig_reviewed/
140+
Headers
141+
Content-Type application/json
142+
Authorization Token <auth token>
143+
Body
144+
[
145+
{
146+
"owner": <user_id>,
147+
"sig_parsed": <sig_parsed_id>,
148+
"sig_correct": "<true|false>",
149+
"sig_corrected": "<sig_corrected>"
150+
}
151+
]

0 commit comments

Comments
 (0)