feat: script to output all the labels , initiation to parsing jsons, may use jquery on mac.

This commit is contained in:
Leonard Excoffier
2024-08-27 21:58:16 -04:00
parent ce0152bbba
commit 4266e09691
2 changed files with 24 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.env .env
.venv .venv
sec_data/ sec_data/
CIK*

23
write_to_db.py Normal file
View File

@@ -0,0 +1,23 @@
import json
# Step 1: Load the JSON data from a file
with open('CIK0000320193.json', 'r') as file:
data = json.load(file)
# Step 2: Access the 'facts' section
facts_section = data.get('facts', {})
# Step 3: Initialize an empty list to store labels
labels_list = []
# Step 4: Iterate over each category in the 'facts' section
for category, facts in facts_section.items():
for fact_name, fact_data in facts.items():
label = fact_data.get('label')
if label:
labels_list.append(label)
# Step 5: Output the list of labels
print("List of all labels:")
for label in labels_list:
print(label)