fedora-copr / log-detective-website

Data collection page for Log Detective AI
11 stars 8 forks source link

Store the submitted logs #6

Closed FrostyX closed 10 months ago

FrostyX commented 11 months ago

We only pprint the user-submitted data, we need to implement storing them. We don't necessarily have to use a database, saving them to a filesystem should be a good alternative.

FrostyX commented 11 months ago

See what data appears in the backend output when submitting the form. Some important data is missing (e.g. the log text) and some probably need to be changed (e.g. snippets should be represented as position in the log text). Please let me know what should I do.

FrostyX commented 10 months ago

@nikromen did a perfect summary what needs to be done but only sent it to me privately, so I am sharing here:

We need frontend to return something like this

{
    "username": "FAS:uwu",
    "logs": {
        "builder-live.log": {
            "log": ["the whole log output"],
            "snippets": [
                {
                    "log_part": "part of the log file in whatever format",
                    "user_comment": "comment from the user"
                },
                ...
            ]
        },
        ...
    },
    "fail_reason": "blabla",
    "how_to_fix": "blabla"
}

What needs to be done:

{
    "comment": "balbla",
    "file": "builder-live.log",
    "text": "toto je zvyrazneny text"
}

but it should be

{
    "builder-live.log": {
        "log": ["the whole log output"],
        "snippets": [
            {
                "log_part": "part of the log in whatever format",
                "user_comment": "comment from the user"
            },
        ]
    },
}
FrostyX commented 10 months ago

@nikromen I did all of the changes you wanted. There are minor differences, please handle them on your side if needed.

I am not doing

"logs": {
    "builder-live.log": {
        ...
    }
}

but this instead

"logs": [
    {
        "name": "builder-live.log",
        ...
    }
]

The position in the log file

"log_part": "part of the log file in whatever format",

is represented like this:

"start_index": 15,
"end_index": 80,

and the whole log content is not a list but string instead

"log": "the whole log output",
nikromen commented 10 months ago

Commits https://github.com/fedora-copr/lightspeed-build-website/commit/76fdb0240e7fbcfedd7bc2f54dfe31f37c832fbf and https://github.com/fedora-copr/lightspeed-build-website/commit/111bab3e58d1d1b408598a154d7f6aa7bb33f945 resolves this issue, but I need to close #17 first since data validation from this issue counts with spec file