From 4266e096919d560f7c9ca33fbd5385e523f68c31 Mon Sep 17 00:00:00 2001 From: Leonard Excoffier <48970393+excoffierleonard@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:58:16 -0400 Subject: [PATCH] feat: script to output all the labels , initiation to parsing jsons, may use jquery on mac. --- .gitignore | 1 + write_to_db.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 write_to_db.py diff --git a/.gitignore b/.gitignore index f8e1378..c0a06d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env .venv sec_data/ +CIK* \ No newline at end of file diff --git a/write_to_db.py b/write_to_db.py new file mode 100644 index 0000000..95bd095 --- /dev/null +++ b/write_to_db.py @@ -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)