kislerdm / diagramastext

Application to streamline diagram generation using plain English instructions instead of code
https://diagramastext.dev
Apache License 2.0
26 stars 1 forks source link

Import users' generated data from cloud watch to the Neon db #39

Closed kislerdm closed 1 year ago

kislerdm commented 1 year ago

Problem

Users generated the data very valuable for model improvement. The data generated before 2023-02-16 are stored to cloudwatch instead of the core db.

Proposed Solution

Parsing details

Example

GIVEN

The log input:

2023-02-14T23:07:04.021Z INIT_START Runtime Version: go:1.v13   Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:3f96445bbbd5587be5ace0de37b48e731074fa350870a8a3cb87f45011d70281

2023-02-14T23:07:04.105Z START RequestId: a54aa4b0-744d-4e1f-91d8-7eb26f99dd6f Version: $LATEST

2023-02-14T23:07:04.106Z 2023/02/14 23:07:04 {"prompt":"C4 diagram of a Go web server reading from external Postgres database over TCP without the big part"}

2023-02-14T23:07:05.576Z 2023/02/14 23:07:05 {"raw":"{"id":"cmpl-6jyg4CeNcXH7dDfOrbWFKYFuBIfVu","object":"text_completion","created":1676416024,"model":"code-cushman-001","choices":[{"text":"{\"nodes\":[{\"id\":\"0\",\"label\":\"Web Server\",\"technology\":\"Go\",\"description\":\"Authenticates users\"},{\"id\":\"1\",\"label\":\"Database\",\"technology\":\"Postgres\",\"external\":true,\"is_database\":true}],\"links\":[{\"from\":\"0\",\"to\":\"1\",\"label\":\"reads from database\",\"technology\":\"TCP\"}]}","index":0,"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":842,"completion_tokens":210,"total_tokens":1052}}

2023-02-14T23:07:05.576Z "}

2023-02-14T23:07:05.576Z 2023/02/14 23:07:05 {"cleaned":"{"nodes":[{"id":"0","label":"Web Server","technology":"Go","description":"Authenticates users"},{"id":"1","label":"Database","technology":"Postgres","external":true,"is_database":true}],"links":[{"from":"0","to":"1","label":"reads from database","technology":"TCP"}]}"}

2023-02-14T23:07:06.987Z END RequestId: a54aa4b0-744d-4e1f-91d8-7eb26f99dd6f

2023-02-14T23:07:06.987Z REPORT RequestId: a54aa4b0-744d-4e1f-91d8-7eb26f99dd6f Duration: 2882.69 ms    Billed Duration: 2883 ms    Memory Size: 256 MB Max Memory Used: 39 MB  Init Duration: 82.83 ms

WHEN

Apply parsing logic - TBD in terms of the task

THEN

The extracted values are expected to correspond to the following fields of db tables.

user_prompt: request_id user_id prompt timestamp
a54aa4b0-744d-4e1f-91d8-7eb26f99dd6f 00000000-0000-0000-0000-000000000000 C4 diagram of a Go web server reading from external Postgres database over TCP without the big part 2023-02-14T23:07:04.106Z 2023/02/14 23:07:04
openai_response: request_id user_id response timestamp
a54aa4b0-744d-4e1f-91d8-7eb26f99dd6f 00000000-0000-0000-0000-000000000000 {"nodes":[{"id":"0","label":"Web Server","technology":"Go","description":"Authenticates users"},{"id":"1","label":"Database","technology":"Postgres","external":true,"is_database":true}],"links":[{"from":"0","to":"1","label":"reads from database","technology":"TCP"}]} 2023-02-14T23:07:05.576Z 2023/02/14 23:07:05

Acceptance Criteria

kislerdm commented 1 year ago

@ColeDrain Hey Ugo! Please find the raw logs data available here.

ColeDrain commented 1 year ago

@kislerdm Logs successfully parsed, the csv files are stored on the repo.

kislerdm commented 1 year ago

@ColeDrain thanks a lot for your contribution, Ugo! 🙏🏻