Skip to content

Commit 9e527b3

Browse files
committed
final commit
1 parent 8650555 commit 9e527b3

16 files changed

+804
-233
lines changed

README.md

+74-24
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,103 @@
11
# RPA FACULTY ASSISTANT
22

3+
> It is a web application made in flask framework and is integrated with the RPA(Robottic Porcess Automation) using the UiPATH Orchestrator Api and Gsheet Api.
4+
> It has two bots one for monitoring the updates in the excel sheet and other one is to check for some document like ppt and synposis presence in some drive.
5+
> The sheets should be in the specific format , the format is provided in the below links:
36
4-
#### Team Members:
7+
- [EXCEL DOCUMENT](static/files/template_monitor.xlsx)
8+
- [DOCUMENT DETECTION](static/files/template_document.xlsx)
9+
10+
> It has the admin page and the user page and visuals using dash app for the user.
11+
> Admin can create users and the users can assign the Task.
12+
> SQLALCHEMY ORM is used.
13+
14+
#### Team Members
515

616
- Raghav Gupta
717
- Umang Bhan
818
- Vastvik Upadhaya
919
- Samar Kant Bhasin
1020
- Sahil Singh
1121

12-
- [MAIN APP FILE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/app.py)
22+
- [MAIN APP FILE](app.py)
1323

14-
- [FORM CLASS FILES](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/forms.py)
24+
- [FORM CLASS FILES](forms.py)
1525

16-
- [GRAPH PROGRAM](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/graph.py)
17-
18-
- [SCHEDULING PROGRAM](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/apis/sched.py)
26+
- [GRAPH PROGRAM](graph.py)
1927

28+
- [SCHEDULING PROGRAM](apis/sched.py)
2029

21-
- [TEMPLATES](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates)
30+
- [GSHEET VALIDATION PROGRAM](apis/gsheet.py)
2231

23-
- [HOMEPAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/index.html)
32+
- [TEMPLATES](templates/)
2433

25-
- [LOGIN PAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/login.html)
34+
- [HOMEPAGE](templates/index.html)
2635

27-
- [REGISTER PAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/register.html)
36+
- [LOGIN PAGE](templates/login.html)
2837

29-
- [ASSIGN TASK PAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/task.html)
38+
- [ADMIN LOGIN PAGE](templates/admin/index.html)
3039

31-
- [DASHBOARD PAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/dashboard.html)
40+
- [ASSIGN TASK PAGE](templates/task.html)
3241

33-
- [CUSTOM 404 PAGE](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/templates/404.html)
34-
35-
- [STATIC FILES](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/static)
42+
- [DASHBOARD PAGE](templates/dashboard.html)
3643

37-
[BOTS](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/Bots/)
38-
39-
- EXCEL MONITOR
40-
- SYNOPSIS DOCUMENT DETECTION
41-
- PPT DOCUMENT DETECTION
44+
- [CUSTOM 404 PAGE](templates/404.html)
4245

43-
- **DATABASE**: [mysql](https://github.com/MIETDevelopers/2017_CSEA2_P7_RPA_FacultyAssistant_Raghav_Umang_Vastavik_Samar_Sahil/tree/master/WebApp/db)
46+
- [STATIC FILES](static/)
47+
48+
- **DATABASE**: [mysql](db)
4449

4550
- tasks table
4651
- users table
4752

48-
- **ROOT DATA FOLDER**: the path to the folder from where the graphs are formed.(/data)
53+
### CONFIGURATION FILE (config.py):
54+
55+
'''json
56+
57+
"LOCALHOST":true,
58+
59+
"LOCALHOST_SQLALCHEMY_DATABASE_URI":"", // mysql server url for localhost
60+
61+
"PROD_SQLALCHEMY_DATABASE_URI":"mysql production server url ",
62+
63+
64+
"DATA_ROOT_DIR":"./data/", // Data directory where all the excel files for processing and visuals will be created.
65+
66+
67+
"BOT_ROOT_DIR":"./bots/", // Path of the Bots folder
68+
69+
70+
"APP_SECRET_KEY":"secret1234", //Secret key to avoid csrf attack
71+
4972

50-
#### REQUIRED CREDENTIALS:
73+
"ADMIN_EMAIL":" ", // Admin email id
74+
75+
76+
"ADMIN_PASSWORD":" ", admin password
77+
78+
79+
"OAUTH_CREDENTIALS_FILE_PATH": "", // oauth credntials used for gsheet activity should be in
80+
81+
%APPDATA%\Roaming\\gspread\\credentials.json
82+
also used for gsuite activity in UIRobot
83+
84+
Credentials used for scheduling
85+
86+
"ORCHESTRATOR_TENANT_NAME": "", // orchestrator Tenant name
87+
88+
"ORCHESTRATOR_ACCOUNT_LOGICAL_NAME": "", // orchestrator Acoount logical name
89+
90+
"ORCHESTRATOR_ACCOUNT_USER_KEY": "", // user key
91+
92+
"ORCHESTRATOR_ACCOUNT_CLIENT_ID": "" client id
93+
94+
'''
95+
96+
### REQUIRED CREDENTIALS:
5197

5298
- **OAUTH CREDENTIALS**: required for gsuite activity.
53-
- **MACHINE KEY , TENANT NAME, ACCOUNT LOGICAL NAME ,USER KEY AND CLIENT ID** : for scheduling bots using Orchestrator
99+
- **MACHINE KEY , TENANT NAME, USER KEY AND CLIENT ID** : scheduling bots using Orchestrator
100+
101+
- UIPATH STUDIO should be installed on the system.
102+
103+
- Python 3.4 and above should be installed.

WebApp/.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
__pycache__/
2-
models.py
32
orchastrator_api_test/
43
graphs/
54
dev/
65
templates/backup/
76
data/
8-
backup_code/
7+
backup_code/
8+
admin_pag/
9+
*.pyc
10+
apis/crypto.py

WebApp/apis/gsheet.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import gspread
2+
3+
4+
def validate_sheet(gsheet_url, sheet_name, doc=0):
5+
6+
# the credentials should be in the `%APPDATA%\\Roaming\gspread\credentials.json`
7+
gc = gspread.oauth()
8+
9+
try:
10+
11+
sh = gc.open_by_url(gsheet_url)
12+
13+
worksheet = sh.worksheet(sheet_name)
14+
if doc == 1:
15+
if 'Project Code' not in worksheet.row_values(1) or 'Title' not in worksheet.row_values(1) or 'Team Member Name' not in worksheet.row_values(1) or 'Roll Number' not in worksheet.row_values(1):
16+
return False, "FORMAT_ERROR"
17+
return True, "SUCCESS"
18+
else:
19+
if str(worksheet.row_values(1)[0]).lower() == "name" and "email" in str(worksheet.row_values(1)[1]).lower():
20+
last_three_cols = worksheet.col_values(1)[-5:]
21+
if "Total Completed" in last_three_cols and "Total % Completed" in last_three_cols and "Total Pending" in last_three_cols:
22+
23+
return True, "SUCCESS"
24+
25+
return False, "FORMAT_ERROR"
26+
27+
return False, "FORMAT_ERROR"
28+
29+
except Exception as e:
30+
if len(e.args)>=2:
31+
d = e.args[0]
32+
else:
33+
return False,"Invalid_URL"
34+
if "status" in d:
35+
return False, d["status"]
36+
else:
37+
return False, f"{sheet_name}_SHEET_NOT_PRESENT"
38+
return d
39+
40+
41+
if __name__ == "__main__":
42+
43+
44+
url = "https://docs.google.com/spreadsheets/d/1kAI4siNQ-0ApPxwydfdeNpdWkrUKElS9R25T87dN_u0/edit#gid=747949193"
45+
46+
url = "https://drive.google.com/file/d/1rgzNz7PaIzvdg2ckWxZKWGp3yk9gz6E-/view?usp=drivesdk"
47+
48+
print(validate_sheet(url, "ACF"))

WebApp/apis/sched.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44

55
### CREDENTIALS:
66

7+
with open(r"D:\c_data\future\MYPROJECTS\RPA\WebApp\config.json") as fp:
8+
params = json.load(fp)["params"]
79

8-
tenant_name = "TENANT_NAME"
10+
print(params)
911

10-
account_logical_name="ACCOUNT LOGICAL NAME"
12+
tenant_name = params["ORCHESTRATOR_TENANT_NAME"]
1113

14+
account_logical_name= params["ORCHESTRATOR_ACCOUNT_LOGICAL_NAME"]
1215

13-
refresh_token = "USER KEY"
16+
17+
refresh_token = params["ORCHESTRATOR_ACCOUNT_USER_KEY"] #user_key
1418

15-
client_id = "CLIENT ID"
19+
client_id = params["ORCHESTRATOR_ACCOUNT_CLIENT_ID"]
1620

1721

1822

@@ -21,6 +25,7 @@ def schedule_tasks(bot_name,trigger_name,input_arguments,curr_hour,stop_date,lon
2125

2226
access_token = auth()
2327

28+
2429
release_info = process_info(access_token)
2530

2631
print(release_info)
@@ -152,6 +157,7 @@ def auth():
152157

153158
url="https://account.uipath.com/oauth/token"
154159

160+
155161
data={
156162

157163
"grant_type": "refresh_token",
@@ -163,11 +169,16 @@ def auth():
163169
"Content-Type": "application/json",
164170
"X-UIPATH-TenantName": tenant_name
165171
}
172+
173+
174+
166175
response = requests.post(url,data=json.dumps(data),headers=headers)
167176

177+
print(json.loads(response.text))
168178

169179
access_token = json.loads(response.text)["access_token"]
170180

181+
171182

172183
return access_token
173184

@@ -289,3 +300,5 @@ def process_info(access_token):
289300

290301
# print(requests.delete(schedule_stop_url,headers=process_headers).text)
291302

303+
304+

0 commit comments

Comments
 (0)