What I Worked On

  • I was the backend developer and worked on imputing data originally but then we eventually switched to an online api with data already on it. After that I worked on just setting up the data so that it worked with the api and url. After completing that I added some functions to the api like search and a get random and then deployed it onto the AWS.

Code

  • This is some code that I worked on and it’s the api which pulls data from our json and has some functions at the bottom to add more onto the api just pulling data.
cards_api = Blueprint('cards_api', __name__,
                  url_prefix='/api/cards')

# API docs https://flask-restful.readthedocs.io/en/latest/api.html
api = Api(cards_api)

def beautify_json_data(json_file_path):
    try:
        with open(json_file_path, 'r') as json_file:
            data = json.load(json_file)

        beautified_data = []
        for item in data.get('items', []):
            beautified_item = {
                "name": item.get("name", ""),
                "maxLevel": item.get("maxLevel", 0),
            }

            medium_icon_url = item.get("iconUrls", {}).get("medium", "")
            if medium_icon_url:
                beautified_item["medium"] = medium_icon_url

            beautified_data.append(beautified_item)

        return beautified_data  # Return the processed data as a list

    except FileNotFoundError:
        return {"error": "File not found"}
    except json.JSONDecodeError:
        return {"error": "Invalid JSON format in the file"}


beautify_json_data("carddb.json")


# getJokes()
class _Read(Resource):
    def get(self):
        json_list = []
        json_list.append(beautify_json_data('carddb.json'))
        return jsonify(json_list)

class _ReadRandom(Resource):
    def get(self):
        beautified_data = beautify_json_data('carddb.json')
        random_item = random.choice(beautified_data)
        return jsonify(random_item)
    
class _Search(Resource):
    def get(self):
        query = request.args.get('query')  # Get the query parameter
        if not query:
            return {"error": "No query provided"}, 400

        beautified_data = beautify_json_data('carddb.json')
        results = [item for item in beautified_data if query.lower() in item['name'].lower()]

        return jsonify(results)

class _Count(Resource):
    def get(self):
        beautified_data = beautify_json_data('carddb.json')
        count = len(beautified_data)
        return {"count": count}

api.add_resource(_Read, '/')
api.add_resource(_ReadRandom, '/random')
api.add_resource(_Search, '/search')
api.add_resource(_Count, '/count')

Me Showcasing

Me Showcasing 1 Me Showcasing 2

Reflection on the Night

  • I remeber getting there and was anxious. I saw some friends in the class and went to go say hi before setting up. After getting everything ready, we started presenting to whoever was interested/came up to us. It was getting easier as time went on but I was still counting down the time. After we were done, I went around just to see what other groups were doing and found some really good ones.
  • I think event was good as a run for me and my group to show off our work that we’ve done over the past few weeks. Although I feel that we could’ve done more, I’m glad I got this opportunity to showcase and also see what others have been working on. I see the level that we are supposed to be working at and to show off. I will strive to do better in the future to make even better works.

Review of Other Teams

  • CSSE Period 3 Table 1 7:30pm Lopez’s Room
    • I really liked their project and what they did. They made a game that had a sandbox build like the old pokemon games. It was really cool to see what they were doing and I want to make something like that. It was really smooth and ran well on their computer. I definetly would like to see how far that game can go if there was even more time as they didn’t fully finish their combat function as there was the same animation for each attack. With more time, they could make something way more cooler.