Skip to content

Commit

Permalink
Merge pull request #605 from sbenthall/i603
Browse files Browse the repository at this point in the history
IETF datatracker working group draft author script and notebook
  • Loading branch information
sbenthall authored Oct 10, 2023
2 parents 4d63205 + 2d90b14 commit cec6535
Show file tree
Hide file tree
Showing 2 changed files with 551 additions and 1 deletion.
45 changes: 44 additions & 1 deletion bigbang/analysis/datatracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,57 @@
from ietfdata.datatracker import *
from ietfdata.datatracker_ext import *
from dateutil.parser import *
import json as json

import pandas as pd
import re

dt = DataTrackerExt()

em_re = "/api/v1/person/email/([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7})/"
def draft_authors_from_working_group(acr):
"""
Get a dataframe of all authors of drafts published
by the working group.
"""

# identify group
g = dt.group_from_acronym(acr)

records = []
# get drafts.
# filter by rfc status here?
for draft in dt.documents(group=g, doctype=dt.document_type_from_slug("draft")): # status argument
# interested in all submissions, or just the most recent?
#
submissions = [dt.submission(sub_url) for sub_url in draft.submissions]
submissions = sorted(submissions, key = lambda s : s.submission_date, reverse=True)

if len(submissions) > 0 :
latest = submissions[0]

authors_text = latest.authors

try:
at = authors_text.replace("'", "\"")
at = at.replace("None", "null")
authors = json.loads(at)
except Exception:
authors = [{'raw_text' : authors_text}]

for a in authors:
a['submission_date'] = latest.submission_date
a['draft_uri'] = latest.draft.uri
a['title'] = latest.title

records.append(authors)

records = sum(records, [])

df = pd.DataFrame.from_records(records)

return df

em_re = "/api/v1/person/email/([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7})/"

def email_from_uri(email_uri):
m = re.match(em_re, email_uri)
Expand Down
Loading

0 comments on commit cec6535

Please sign in to comment.