Completed Anthology script to parse the long JS nodes.

This commit is contained in:
Norm Rasmussen
2023-11-01 16:57:42 -04:00
parent 79721ef1e5
commit 5b2363bae2
3 changed files with 43 additions and 17 deletions

View File

@ -1,26 +1,47 @@
import csv
import pandas as pd
import re
listtuple = []
linelist = []
count = 0
LISTTUPLE = []
LINELIST = []
COUNT = 0
DOMAIN_DICT = {}
df = pd.DataFrame()
with open('./Workflows_js_nodes.js', 'r') as file:
for num, line in enumerate(file, 1):
if "<<<" in line:
linelist.append(num)
LINELIST.append(num)
if ">>>" in line:
linelist.append(num)
linelist = sorted(linelist)
x = len(linelist)
LINELIST.append(num)
LINELIST = sorted(LINELIST)
# print(LINELIST)
x = len(LINELIST)
try:
while count in range(x):
count += 1
temp_tupe = (linelist[0], linelist[1])
listtuple.append(temp_tupe)
linelist.pop(0)
linelist.pop(1)
while COUNT in range(x):
COUNT += 1
temp_tupe = (LINELIST[0], LINELIST[1])
LISTTUPLE.append(temp_tupe)
LINELIST = LINELIST[2:]
# LINELIST.pop(1)
except IndexError as e:
print(e)
pass
print(listtuple)
for pagetuple in LISTTUPLE:
res_list = []
domain_line = int(pagetuple[0]-2)
seg_start = int(pagetuple[0]-1)
seg_end = int(pagetuple[1]-1)
with open('./Workflows_js_nodes.js', 'r') as file:
lines = file.readlines()
title = lines[domain_line][4:-1]
segment = lines[seg_start:seg_end]
for line in segment:
result = re.search(r"(?:'@[a-z|.]+.[a-z]{3})", line)
if result:
res = result.group()[1:]
res_list.append(res)
DOMAIN_DICT[title] = res_list
df = df.from_dict(DOMAIN_DICT, orient='index')
df.to_csv('~/Downloads/test-anthodomains.csv')

View File

@ -191,3 +191,8 @@ TODO: Enable search query dashboard on Swift Medical
* Open doc directly from another page without authentication
* Kayla is used to this with all higher ed LMSes and would like for this to be Northpass Functionality.
## 11/1/2023
### Learning Page & App Delayed

View File

@ -4,7 +4,7 @@ from pathlib import Path
import Apikeys
import os
basefile = "/Users/normrasmussen/Downloads/Mizuno-September23-Completions.csv"
basefile = "/Users/normrasmussen/Downloads/Mizuno_Completions.csv"
api_key = Apikeys.mizuno
uuid_url = "https://api.northpass.com/v2/people?filter[email][eq]="
prop_url = "https://api.northpass.com/v2/properties/people/"
@ -51,7 +51,7 @@ def load_file(basefile):
# completions = completions.iloc[:, 0:]
print(completions)
completions.to_csv(
"/Users/normrasmussen/Downloads/Mizuno-09.23-Completions_with_PGAIDs.csv",
"/Users/normrasmussen/Downloads/Mizuno-10.23-Completions_with_PGAIDs.csv",
index=False,
)