Skip to content

Commit

Permalink
resume.json data + load_data function
Browse files Browse the repository at this point in the history
  • Loading branch information
vantage-ola committed Oct 9, 2024
1 parent 1f8abb5 commit e28e2b9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
37 changes: 36 additions & 1 deletion data/resume.json
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
{ "data": "TODO: resume data" }
{
"user": [
{
"name": "Jackie Stewart",
"phone_number": "+4478322678",
"email_address": "jack@resume.com"
}
],
"experience": [
{
"title": "Software Developer",
"company": "A Cool Company",
"start_date": "October 2022",
"end_date": "Present",
"description": "Writing Python Code",
"logo": "example-logo.png"
}
],
"education": [
{
"degree": "Computer Science",
"institution": "University of Tech",
"start_date": "September 2019",
"end_date": "July 2022",
"grade": "80%",
"logo": "example-logo.png"
}
],
"skill": [
{
"name": "Python",
"experience": "1-2 Years",
"logo": "example-logo.png"
}
]
}
20 changes: 17 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Util functions for the Flask App."""
import json
import re
from spellchecker import SpellChecker

Expand All @@ -25,6 +26,19 @@ def correct_spelling(text: str):

return corrected_text

# TODO: function to load json file
def load_data():
pass
def load_data(file_path):
""" Loads the json file """
try:
with open(file_path, 'r') as file:
data = json.load(file)
print(f"Successfully loaded data from {file_path}")
return data
except FileNotFoundError:
print(f"Error: The file {file_path} was not found.")
return None
except json.JSONDecodeError:
print(f"Error: The file {file_path} contains invalid JSON.")
return None
except Exception as e:
print(f"An unexpected error occurred: {e}")
return None

0 comments on commit e28e2b9

Please sign in to comment.