bahrain-bp / bqa-genai-challenge

This repository will include the BQA GenAI challenge artifacts
0 stars 0 forks source link

Altering Standards DynamoDB Table Logic to Prevent Duplicate Printing #168

Closed Mrymk02 closed 2 months ago

Mrymk02 commented 2 months ago

Problem Description:

The current logic of the DynamoDB table, named "BQA," needs to be altered to address an issue with the printing of standards. The table is defined using the following code:

const table = new Table(stack, "BQA", {
    fields: {
        entityType: "string",
        entityId: "string",
        standardId: "string",
        standardName: "string",   // Attribute for standards
        indicatorId: "string",
        indicatorName: "string",
        status: "string",        // Attribute for status
        description: "string",
        documentName: "string",
        documentURL: "string"
    },
    primaryIndex: { partitionKey: "entityType", sortKey: "entityId" },
});

The issue lies in the fact that each standard should be represented as an array of objects, allowing for multiple files associated with each indicator. However, the current implementation results in the standards being printed multiple times for each indicator, which is undesired behavior.

Preposed solution:

As a solution to this problem, I propose the following steps:

  1. Update the DynamoDB BQA table schema so it includes an array of objects (string) for the standards attribute.
  2. Update lambda of CRUD operations in the BQA table to match the changes made in the schema.
Mrymk02 commented 2 months ago

switching to branch:

git fetch origin git checkout 168-altering-standards-dynamodb-table-logic-to-prevent-duplicate-printing

FatimaJ20 commented 2 months ago

I was able to solve the issue by adding a condition that it shouldn't print duplicates, and only print the indicator once. This problem occurred in the upload evidence page; because I'm fetching the standard and indicators, names and ids from the db. When the reviewer uploads a file in the predefined temp, its kind of like the record will get repeated for each file, that is why some of the indicators got duplicated; because the predefined temp had 2 files in it, if it were 3 I would've had 3 duplicates and so on.

Anyways, that was resolved, I also worked on organizing the indicators by there numbers (id).

image