-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathlambda_function.py
More file actions
281 lines (277 loc) · 9.19 KB
/
lambda_function.py
File metadata and controls
281 lines (277 loc) · 9.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
from .ingest import ingest_comment_opensearch, ingest_docket, ingest_document
def lambda_handler(event, context):
docket = """
{
"data": {
"attributes": {
"agencyId": "DOS",
"category": "Public Notices - None Rule Related",
"displayProperties": [
{
"label": "Effective Date",
"name": "effectiveDate",
"tooltip": "An agency- specified date associated with a docket (regulatory action)."
}
],
"dkAbstract": "SUMMARY: The Department of State is amending the International Traffic in Arms Regulations (ITAR) to better organize the purposes and definitions of the regulations. This rule consolidates and co-locates authorities, general guidance, and definitions.",
"docketType": "Rulemaking",
"effectiveDate": "2022-09-06T04:00:00Z",
"field1": null,
"field2": null,
"generic": null,
"keywords": [
"DOSAR",
"60 Day Information Collection",
"Counsular Affairs",
"African Affairs",
"30 Day Information Collection",
"Aliens",
"Arms Export",
"Counterterrorism",
"Arms Control"
],
"legacyId": null,
"modifyDate": "2023-01-05T11:19:18Z",
"objectId": "0b00006484f6e7f3",
"organization": null,
"petitionNbr": null,
"program": null,
"rin": "1400-AE27",
"shortTitle": null,
"subType": "ITAR",
"subType2": null,
"title": "International Traffic in Arms Regulations: Consolidation and Restructuring of Purposes and Definitions"
},
"id": "DOS-2022-0004",
"links": {
"self": "https://api.regulations.gov/v4/dockets/DOS-2022-0004"
},
"type": "dockets"
}
}
"""
document = """
{
"data": {
"attributes": {
"additionalRins": null,
"address1": null,
"address2": null,
"agencyId": "DOS",
"allowLateComments": false,
"authorDate": null,
"authors": null,
"category": null,
"cfrPart": "22 CFR Parts 120, 121, 122, 123, 124, 125, 126",
"city": null,
"comment": null,
"commentEndDate": "2022-05-10T03:59:59Z",
"commentStartDate": "2022-03-23T04:00:00Z",
"country": null,
"displayProperties": [
{
"label": "Page Count",
"name": "pageCount",
"tooltip": "Number of pages In the content file"
}
],
"docAbstract": null,
"docketId": "DOS-2022-0004",
"documentType": "Rule",
"effectiveDate": null,
"email": null,
"exhibitLocation": null,
"exhibitType": null,
"fax": null,
"field1": null,
"field2": null,
"fileFormats": [
{
"fileUrl": "https://downloads.regulations.gov/DOS-2022-0004-0001/content.pdf",
"format": "pdf",
"size": 756575
},
{
"fileUrl": "https://downloads.regulations.gov/DOS-2022-0004-0001/content.htm",
"format": "htm",
"size": 154561
}
],
"firstName": null,
"frDocNum": "2022-05629",
"frVolNum": null,
"govAgency": null,
"govAgencyType": null,
"implementationDate": null,
"lastName": null,
"legacyId": null,
"media": null,
"modifyDate": "2022-05-10T01:01:14Z",
"objectId": "0900006484fdb1f2",
"ombApproval": null,
"openForComment": false,
"organization": null,
"originalDocumentId": "DOS_FRDOC_0001-5785",
"pageCount": 31,
"paperLength": 0,
"paperWidth": 0,
"phone": null,
"postedDate": "2022-03-23T04:00:00Z",
"postmarkDate": null,
"reasonWithdrawn": null,
"receiveDate": "2022-03-23T04:00:00Z",
"regWriterInstruction": null,
"restrictReason": null,
"restrictReasonType": null,
"sourceCitation": null,
"startEndPage": "16396 - 16426",
"stateProvinceRegion": null,
"subject": "Arms and Munitions, Classified Information, Exports, Reporting and Recordkeeping, Technical Assistance, Crime, Penalties, Seizures and Forfeitures, Administrative Practice and Procedure, Brok",
"submitterRep": null,
"submitterRepAddress": null,
"submitterRepCityState": null,
"subtype": null,
"title": "International Traffic in Arms: Consolidation and Restructuring of Purposes and Definitions",
"topics": [
"Arms and Munitions",
"Classified Information",
"Exports",
"Reporting and Recordkeeping Requirements",
"Technical Assistance",
"Crime",
"Penalties",
"Seizures and Forfeitures",
"Administrative Practices and Procedures",
"Brokers",
"Campaign Funds",
"Confidential Business Information"
],
"trackingNbr": null,
"withdrawn": false,
"zip": null
},
"id": "DOS-2022-0004-0001",
"links": {
"self": "https://api.regulations.gov/v4/documents/DOS-2022-0004-0001"
},
"relationships": {
"attachments": {
"links": {
"related": "https://api.regulations.gov/v4/documents/DOS-2022-0004-0001/attachments",
"self": "https://api.regulations.gov/v4/documents/DOS-2022-0004-0001/relationships/attachments"
}
}
},
"type": "documents"
}
}
"""
comment = """
{
"data": {
"id": "DOS-2022-0004-0003",
"type": "comments",
"links": {
"self": "https://api.regulations.gov/v4/comments/DOS-2022-0004-0003"
},
"attributes": {
"commentOn": "0900006484fdb1f2",
"commentOnDocumentId": "DOS-2022-0004-0001",
"duplicateComments": 0,
"address1": null,
"address2": null,
"agencyId": "DOS",
"city": null,
"category": null,
"comment": "See attached file(s)",
"country": null,
"displayProperties": [
{
"name": "pageCount",
"label": "Page Count",
"tooltip": "Number of pages In the content file"
}
],
"docAbstract": null,
"docketId": "DOS-2022-0004",
"documentType": "Public Submission",
"email": null,
"fax": null,
"field1": null,
"field2": null,
"fileFormats": null,
"firstName": null,
"govAgency": null,
"govAgencyType": null,
"objectId": "0900006485063c49",
"lastName": null,
"legacyId": null,
"modifyDate": "2022-05-12T15:52:38Z",
"organization": "Raytheon Technologies Corporation",
"originalDocumentId": null,
"pageCount": 1,
"phone": null,
"postedDate": "2022-05-10T04:00:00Z",
"postmarkDate": null,
"reasonWithdrawn": null,
"receiveDate": "2022-05-09T04:00:00Z",
"restrictReason": null,
"restrictReasonType": null,
"stateProvinceRegion": null,
"submitterRep": null,
"submitterRepAddress": null,
"submitterRepCityState": null,
"subtype": null,
"title": "Comment on DOS-2022-0004-0001",
"trackingNbr": "l2z-02tq-bsbu",
"withdrawn": false,
"zip": null,
"openForComment": false
},
"relationships": {
"attachments": {
"data": [
{
"id": "0900006485063c4a",
"type": "attachments"
}
],
"links": {
"self": "https://api.regulations.gov/v4/comments/DOS-2022-0004-0003/relationships/attachments",
"related": "https://api.regulations.gov/v4/comments/DOS-2022-0004-0003/attachments"
}
}
}
},
"included": [
{
"id": "0900006485063c4a",
"type": "attachments",
"links": {
"self": "https://api.regulations.gov/v4/attachments/0900006485063c4a"
},
"attributes": {
"agencyNote": null,
"authors": null,
"docAbstract": null,
"docOrder": 1,
"fileFormats": [
{
"fileUrl": "https://downloads.regulations.gov/DOS-2022-0004-0003/attachment_1.pdf",
"format": "pdf",
"size": 235577
}
],
"modifyDate": "2022-05-09T13:41:01Z",
"publication": null,
"restrictReason": null,
"restrictReasonType": null,
"title": "Raytheon Technologies Corp. Comments re DOS-2022-0004"
}
}
]
}
"""
ingest_docket(docket)
ingest_document(document)
ingest_comment_opensearch(comment)