Abbreve icon indicating copy to clipboard operation
Abbreve copied to clipboard

[FEATURE] Improve on structure for db

Open mathiasayivor opened this issue 2 years ago • 3 comments

Description

The current structure of db looks like:

[abbreviation]: {
    definition: string,
    alternatives?: string
}

which is good, but we can improve on the structure by making the alternatives prop required and an array. So the new structure now becomes:

[abbreviation]: {
    definition: string,
    alternatives: string[]
}

Using the proposed structure gives us the possibility to add other features, such as linking related abbreviations and other benefits as the app grows

Below is an example showing the current structure and how it would look like after implementing the proposed structure BEFORE:

{
    "lgtm":{
        "definition":"Looks Good To Me",
        "alternatives": "Looks Great To Me, Looks Great To Merge"
    },

    "lfg":{
        "definition":"Let's Fucking Go",
        "alternatives" : "Life Feels Good, Looking For Group"
    },

    "idk":{
        "definition": "I Don't Know"
    },

    "imo":{
        "definition": "In My Opinion"
    }
}

AFTER:

{
    "lgtm":{
        "definition":"Looks Good To Me",
        "alternatives": ["Looks Great To Me", "Looks Great To Merge"]
    },

    "lfg":{
        "definition":"Let's Fucking Go",
        "alternatives" : ["Life Feels Good", "Looking For Group"]
    },

    "idk":{
        "definition": "I Don't Know",
        "alternatives": []
    },

    "imo":{
        "definition": "In My Opinion",
        "alternatives": []
    }
}

Screenshots

No response

Additional information

We can even further improve on the structure to include more information like so:

[definition]: {
    definition: string,
    contexts: string[], // Check explanation at the bottom
    alternatives: {
        definition: string,
        contexts: string[] // Check explanation at the bottom
    }[]
}

Example:

{
    "lgtm": {
        "definition": "Looks Good To Me",
        "contexts": [
            "chat",
            "conversation"
        ],
        "alternatives": [
            {
                "definition": "Looks Great To Me",
                "contexts": []
            },
            {
                "definition": "Looks Great To Merge",
                "contexts": [
                    "collaboration",
                    "teamwork"
                ]
            }
        ]
    },
    "lfg": {
        "definition": "Let's Fucking Go",
        "contexts": [],
        "alternatives": [
            {
                "definition": "Life Feels Good",
                "contexts": []
            },
            {
                "definition": "Looking For Group",
                "contexts": []
            }
        ]
    },
    "idk": {
        "definition": "I Don't Know",
        "contexts": [],
        "alternatives": []
    },
    "imo": {
        "definition": "In My Opinion",
        "contexts": [],
        "alternatives": []
    }
}

Explanation: The contexts field is an array of contexts in which the abbreviation is mostly used.

Notes: Automatically, all alternatives under each abbreviation fall under the contexts provided for the main definition e.g Both Looks Great To Me and Looks Great To Merge fall under chat and conversation contexts since they are both alternatives to the Looks Good To Me definition

DISCLAIMER! The items I used for each context are just for demonstration purposes.

mathiasayivor avatar Oct 03 '22 23:10 mathiasayivor

I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives.

I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice: Screen Shot 2022-10-04 at 7 42 49 PM

adropofilm avatar Oct 05 '22 00:10 adropofilm

I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives.

I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice: Screen Shot 2022-10-04 at 7 42 49 PM

Making the alternatives prop required promotes a consistent data structure.

And if the abbrev doesn't have any alternatives, you pass an empty array

mathiasayivor avatar Oct 05 '22 00:10 mathiasayivor

I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives. I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice: Screen Shot 2022-10-04 at 7 42 49 PM

Making the alternatives prop required promotes a consistent data structure.

And if the abbrev doesn't have any alternatives, you pass an empty array

Gotcha, makes sense then. :)

adropofilm avatar Oct 05 '22 01:10 adropofilm