Using ChatGPT to build System Diagram – Translators

Tram Ho

The popularity of ChatGPT is growing and now it is being used in a lot of applications. As a software architect, I had the opportunity to explore the possibilities of ChatGPT for use in the financial sector, especially in asset management.

Illustrated graphs

I wanted to confirm if ChatGPT can generate diagrams to explain a use case and analyze multiple factors at the same time.

So I logged into chat.openai.com and here is my chat:

Step 1: Let’s define the use case

I could define my own use case, but I wanted to test all aspects of ChatGPT, so I asked it to define one for me.

Step 2: Define a data model for the use case

Looks nice to me, let’s start by defining the data model – so I asked ChatGPT to do that and this is the result I got.

Sounds right, let’s see what it can do for schematics. I want to delve deeper into data modeling, so my next message is…

Prompt: describe the data model in more detail or tabular format using markdown ChatGPT: I can describe the structure of the data model in a tabular format using markdown.

This is a good start. Next, I ask to define the relationships.

Step 3: Let’s define relationships – Entity relationship diagram.

Prompt: this is perfect, I would like to depict the relationships in a mermaid diagram, can you give me the markdown code to do this ChatGPT: I apologize, but as a text-based model, I am not able to generate Mermaid diagrams or any other visual diagrams. However, I can provide you with an example of how the relationships could be represented in Mermaid syntax:

And after copying this into the markdown editor, closing in the {mermaid} tag, I get…

Step 4: Sequence diagram

Next, I tried to generate hypothetical messages to test the response. My first purpose is to create a sequence diagram.

Prompt: how would a Buy transaction for an asset impact the tables mentioned above, I would like to depict this as a sequence diagram. Can you help describe the diagram in markdown format for mermaid ChatGPT: Sure, a Buy transaction would have an impact on the following tables:

Asset table: the current_value of the asset would be updated to reflect the current market value of the asset Portfolio table: the current_value of the portfolio would be updated to reflect the new asset and its market value, and the asset_allocation would be updated to reflect the new assets. Transaction table: a new transaction would be added with the transaction details such as the transaction type, transaction date, asset_id, and portfolio_id

Here is an example of how the process could be represented in a Mermaid sequence diagram:

and then copy it into the markdown editor.

Impressive isn’t it? But I’m not done yet.

Step 5: State transition diagram

Ask about a state transition diagram.

Prompt: Will the account have states like new, closed, active inactive etc? I would like to depict the states in a state diagram using mermaid. Can you help describe the diagram in markdown format ChatGPT: It is common for financial accounts to have different states, such as new, closed, active, and inactive, to reflect the current status of the account.

new account would be one that has just been opened and is awaiting funding or verification. active account would be one that is currently open and being used for transactions. inactive account would be one that is not currently being used but has not been closed. closed account would be one that has been closed by the customer or the financial institution, and no longer able to be used for transactions. Pending state could be used to indicate that the account is under review or awaiting verification. Suspended state could be used to indicate that the account has been temporarily suspended, for example, due to suspicious activity or non-compliance with terms and conditions. Frozen state could be used to indicate that the account has been frozen, for example, due to a legal dispute or regulatory action. Expired state could be used to indicate that the account has its expiration date and is no longer in use.

here is an example of how the states of an account could be represented in a Mermaid state diagram:

It seems that this format is outdated and can be problematic due to repeated dependencies. So I asked ChatGPT to improve it.

Prompt: can you try giving the state diagram markdown syntax in new format using [ ] ChatGPT: Sure, here is an example of how a state diagram for a wealth management system’s account management component could be represented in Mermaid using the new format with [ ] :

Markdown Editor Representation

This diagram shows the different states of an account and the transitions that can occur between them.

The initial state is [*], representing the starting state.

  • The account can switch from the New state to the Active state by activating it.
  • An account can go from New to Closed by closing it.
  • Accounts can go from Active to Inactive by disabling it.
  • An account can move from the Active state to the Closed state by closing it.
  • An account can go from an Inactive state to an Active state by activating it.
  • An account can go from Inactive to Closed by closing it.
  • Now we have gone somewhere. Let’s expand this further to include other states as well.

Prompt: please include expired, frozen and other relevant states as well

ChatGPT: Sure, here is an example of how a state diagram for a wealth management system’s account management component could be represented in Mermaid including additional states such as Expired, Frozen, etc:

Description: This diagram shows the different states of an account and the possible transitions between them.

The initial state is [*] which denotes the start state. The account can transition from New state to Active state by activating it. The account can transition from New state to Closed state by closing it. The account can transition from Active state to Inactive state by deactivating it. The account can transition from Active state to Frozen state by freezing it. The account can transition from Active state to Closed state by closing it. The account can transition from Inactive state to Active state by activating it. The account can transition from Inactive state to Frozen state by freezing it. The account can transition from Inactive state to Closed state by closing it. The account can transition from Frozen state to Active state by unfreezing it. The account can transition from Frozen state to Closed state by closing it. The account can transition from Closed state to Expired state if the account is expired.

And Diagrammatic Representation

This is wonderful. It’s impressive what can be achieved with ChatGPT and Mermaid.

Source: https://congdongchatgpt.com/d/57-su-dung-chatgpt-de-xay-dung-so-do-he-thong

Share the news now

Source : Viblo