Using ChatGPT to build System Diagrams — Part I
Interested in Mindmaps — read our blog post on using plantUML with ChatGPT to create awesome Mindmaps
The popularity of ChatGPT keeps growing and it’s now being used in a wide range of applications. As a software architect, I had the opportunity to explore ChatGPT’s capabilities for use within the financial domain, specifically for Wealth Management.
I wanted to confirm if ChatGPT could generate diagrams for a use case explanation and analyze multiple factors at the same time.
So, I logged into chat.openai.com and here is my conversation
Step 1: Let’s define the use-case
I could have defined my own use-case, but I wanted to test all aspects of ChatGPT, so I asked it to define one for me.

Step 2: Let’s define a Data Model for the use-case
Looks good to me, let’s start by defining the data model — so I asked ChatGPT to do it and this is what I got

That sounds about right, lets see what it can do for diagrams. I wanted to drill a bit deeper on the data model so my next prompt was
Prompt:
describe the data model in more detail or tabular format using markdownChatGPT: I can describe the structure of the data model in a tabular format using markdown.

This is a good start. Next I asked for defining 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 copying this in a markdown editor enclosed within {mermaid} tags, I got

Great, we are getting somewhere.
I have a class diagram / entity-relationship diagram. Let’s see what else is possible
Step 4: Sequence Diagram
Next, I tried to make hypothetical prompts to check responses. My first intention was to get a sequence diagram created
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
Buytransaction would have an impact on the following tables:
Assettable: thecurrent_valueof the asset would be updated to reflect the current market value of the assetPortfoliotable: thecurrent_valueof the portfolio would be updated to reflect the new asset and its market value, and theasset_allocationwould be updated to reflect the new asset.Transactiontable: 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 copying this is in a markdown editor

Impressive. But I am not done yet
Step 5: State Transition Diagram
Let me 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.
newaccount would be one that has just been opened and is awaiting funding or verification.activeaccount would be one that is currently open and being used for transactions.inactiveaccount would be one that is not currently being used but has not been closed.closedaccount would be one that has been closed by the customer or the financial institution, and no longer able to be used for transactions.Pendingstate could be used to indicate that the account is under review or awaiting verification.Suspendedstate 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.Frozenstate could be used to indicate that the account has been frozen, for example, due to a legal dispute or regulatory action.Expiredstate could be used to indicate that the account has reached 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:

Looks like, this format is older and may break due to cyclical dependencies. So I asked ChatGPT to improve this
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 possible transitions between them.
- The initial state is
[*]which denotes the start state. - The account can transition from
Newstate toActivestate by activating it. - The account can transition from
Newstate toClosedstate by closing it. - The account can transition from
Activestate toInactivestate by deactivating it. - The account can transition from
Activestate toClosedstate by closing it. - The account can transition from
Inactivestate toActivestate by activating it. - The account can transition from
Inactivestate toClosedstate by closing it.
Now we are getting somewhere. Let’s extend 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 fromNewstate toActivestate by activating it. The account can transition fromNewstate toClosedstate by closing it. The account can transition fromActivestate toInactivestate by deactivating it. The account can transition fromActivestate toFrozenstate by freezing it. The account can transition fromActivestate toClosedstate by closing it. The account can transition fromInactivestate toActivestate by activating it. The account can transition fromInactivestate toFrozenstate by freezing it. The account can transition fromInactivestate toClosedstate by closing it. The account can transition fromFrozenstate toActivestate by unfreezing it. The account can transition fromFrozenstate toClosedstate by closing it. The account can transition fromClosedstate toExpiredstate if the account is expired.

And Diagrammatic Representation

This is awesome. Truly impressive on what can be achieved with ChatGPT and Mermaid
Thanks for reading!
Please subscribe here to never miss our new posts and don’t forget to clap if you enjoyed reading this post






