Spaces:
Sleeping
Sleeping
Update API.py
Browse files
API.py
CHANGED
|
@@ -22,9 +22,9 @@ from datetime import datetime
|
|
| 22 |
# from save_thread_result import ThreadWithResult
|
| 23 |
from threading import Thread, Event
|
| 24 |
|
| 25 |
-
prjnamesURL= 'https://docs.google.com/spreadsheets/d/
|
| 26 |
-
prjpartsURL= 'https://docs.google.com/spreadsheets/d/
|
| 27 |
-
prjsectionsURL= 'https://docs.google.com/spreadsheets/d/
|
| 28 |
|
| 29 |
|
| 30 |
dfNames=pd.DataFrame()
|
|
@@ -142,16 +142,16 @@ def AppendtablestoSheets():
|
|
| 142 |
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 143 |
def getPrjNames(url=prjnamesURL):
|
| 144 |
#url first sheet of names
|
| 145 |
-
url_1 = url.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 146 |
-
df = pd.read_csv(
|
| 147 |
return df['ProjectName'].tolist(), df['ProjectId'].tolist()
|
| 148 |
|
| 149 |
# %%
|
| 150 |
def getprjParts(chosenprjid,urlNames=prjnamesURL,urlparts=prjpartsURL):
|
| 151 |
|
| 152 |
-
url_2 = urlparts.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 153 |
global dfParts
|
| 154 |
-
dfParts = pd.read_csv(
|
| 155 |
print(chosenprjid,dfParts)
|
| 156 |
dfParts= dfParts.iloc[np.where(dfParts['ProjectId']==int(chosenprjid))]
|
| 157 |
parts=dfParts['ProjectPart'].tolist()
|
|
@@ -164,8 +164,8 @@ def getprjParts(chosenprjid,urlNames=prjnamesURL,urlparts=prjpartsURL):
|
|
| 164 |
# %%
|
| 165 |
def getprjSections(chosenprjid, chosenpartid,urlSection=prjsectionsURL):
|
| 166 |
#GetprojectSections
|
| 167 |
-
url_1 = urlSection.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 168 |
-
dfSections = pd.read_csv(
|
| 169 |
if chosenprjid and chosenpartid:
|
| 170 |
dfSections=dfSections.iloc[np.where((dfSections['ProjectId']==int(chosenprjid)) & (dfSections['ProjectPartId']==int(chosenpartid)) ) ]
|
| 171 |
sections=dfSections['ProjectSection'].tolist()
|
|
|
|
| 22 |
# from save_thread_result import ThreadWithResult
|
| 23 |
from threading import Thread, Event
|
| 24 |
|
| 25 |
+
prjnamesURL= 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=0'
|
| 26 |
+
prjpartsURL= 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=34865056'
|
| 27 |
+
prjsectionsURL= 'https://docs.google.com/spreadsheets/d/1nsIgi9o9VSBKQlNxbxihPzG_N7s4um0eNVfgL4gaGPc/export?format=csv&gid=1751466819'
|
| 28 |
|
| 29 |
|
| 30 |
dfNames=pd.DataFrame()
|
|
|
|
| 142 |
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 143 |
def getPrjNames(url=prjnamesURL):
|
| 144 |
#url first sheet of names
|
| 145 |
+
# url_1 = url.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 146 |
+
df = pd.read_csv(prjnamesURL)
|
| 147 |
return df['ProjectName'].tolist(), df['ProjectId'].tolist()
|
| 148 |
|
| 149 |
# %%
|
| 150 |
def getprjParts(chosenprjid,urlNames=prjnamesURL,urlparts=prjpartsURL):
|
| 151 |
|
| 152 |
+
# url_2 = urlparts.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 153 |
global dfParts
|
| 154 |
+
dfParts = pd.read_csv(prjpartsURL)
|
| 155 |
print(chosenprjid,dfParts)
|
| 156 |
dfParts= dfParts.iloc[np.where(dfParts['ProjectId']==int(chosenprjid))]
|
| 157 |
parts=dfParts['ProjectPart'].tolist()
|
|
|
|
| 164 |
# %%
|
| 165 |
def getprjSections(chosenprjid, chosenpartid,urlSection=prjsectionsURL):
|
| 166 |
#GetprojectSections
|
| 167 |
+
# url_1 = urlSection.replace('/edit#gid=', '/export?format=csv&gid=')
|
| 168 |
+
dfSections = pd.read_csv(prjsectionsURL)
|
| 169 |
if chosenprjid and chosenpartid:
|
| 170 |
dfSections=dfSections.iloc[np.where((dfSections['ProjectId']==int(chosenprjid)) & (dfSections['ProjectPartId']==int(chosenpartid)) ) ]
|
| 171 |
sections=dfSections['ProjectSection'].tolist()
|