diff --git a/data/resume.json b/data/resume.json index eb7b622..56eb418 100644 --- a/data/resume.json +++ b/data/resume.json @@ -1 +1,36 @@ -{ "data": "TODO: resume data" } \ No newline at end of file +{ + "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" + } + ] +} diff --git a/utils.py b/utils.py index d660ea4..1e0d6e3 100644 --- a/utils.py +++ b/utils.py @@ -1,4 +1,5 @@ """ Util functions for the Flask App.""" +import json import re from spellchecker import SpellChecker @@ -25,6 +26,19 @@ def correct_spelling(text: str): return corrected_text -# TODO: function to load json file -def load_data(): - pass \ No newline at end of file +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