yes-man-today commited on
Commit
21c5194
·
1 Parent(s): 82b195a
Files changed (1) hide show
  1. regulatory_comments_api.py +3 -6
regulatory_comments_api.py CHANGED
@@ -124,18 +124,15 @@ class RegulationsDataFetcher:
124
  # Data cleaning: check for non-empty text, absence of "see attachment", and text not being "N/A"
125
  if (comment_text and "see attachment" not in comment_text.lower() and comment_text.lower() != "n/a"):
126
  # Replace empty commenter_fname with "Anonymous"
127
- commenter_fname = (comment_data.get('firstName', '').split(',')[0]).strip()
128
- commenter_fname = commenter_fname.capitalize() if commenter_fname else "Anonymous"
129
-
130
  nested_comment = {
131
  "text": comment_text,
132
  "comment_id": comment['id'],
133
  "comment_url": comment['links']['self'],
134
  "comment_date": comment['attributes']['postedDate'].split('T')[0],
135
  "comment_time": comment['attributes']['postedDate'].split('T')[1].strip('Z'),
136
- "commenter_fname": commenter_fname,
137
- "commenter_lname": (comment_data.get('lastName', '').split(',')[0]).capitalize(),
138
- "comment_length": len(comment_text)
139
  }
140
  nested_data["comments"].append(nested_comment)
141
 
 
124
  # Data cleaning: check for non-empty text, absence of "see attachment", and text not being "N/A"
125
  if (comment_text and "see attachment" not in comment_text.lower() and comment_text.lower() != "n/a"):
126
  # Replace empty commenter_fname with "Anonymous"
 
 
 
127
  nested_comment = {
128
  "text": comment_text,
129
  "comment_id": comment['id'],
130
  "comment_url": comment['links']['self'],
131
  "comment_date": comment['attributes']['postedDate'].split('T')[0],
132
  "comment_time": comment['attributes']['postedDate'].split('T')[1].strip('Z'),
133
+ "commenter_fname": ((comment_data.get('firstName') or '').split(',')[0]).capitalize(),
134
+ "commenter_lname": ((comment_data.get('lastName') or '').split(',')[0]).capitalize(),
135
+ "comment_length": len(comment_text) if comment_text is not None else 0
136
  }
137
  nested_data["comments"].append(nested_comment)
138