Home > Net >  How can I implement IF condition in ER diagram?
How can I implement IF condition in ER diagram?

Time:10-03

I have the following ER diagrams:

  • enter image description here

  • enter image description here

    I'm new to ER diagram and I want to add an alert system in banking process. Customer entity can start a transaction with his/her bank account in transact_with relationship. In the relationship, there are attributes such as counterpart_name and counterpart_country. If counterpart's name in remittance is the same as the name from watch_list the bank is keeping, the DB creates a new row in the table named Alert. And I wonder how can I establish that Alert entity and relationships between other entities.

    Since counterpart_name is a attribute from a relationship, if I want to relate that attribute with watch_list entity, it seems like it becomes ternary relationship but I don't want watch_list to be related with customer and account entity in normal transaction process. Any suggestions on this, please?

    CodePudding user response:

    ERD won't help you because it doesn't capture rules. See here: https://en.wikipedia.org/wiki/Entity–relationship_model

    Of course, if you want to create an ALERT table, then ERD is fine.

    The "if" part which fires a trigger (or whatever) could be modeled by a UML sequence diagram (for example).

    Put another way, the ALERT table is data, the "if" is control and they are served by different diagram types. Good luck

    CodePudding user response:

    You can and should relate the ALERT entity with the entity WATCH_LIST and TRANSACT_WITH:

    • If these relationships would not exist, you would know to which watch list element the transaction is related, and use the score mentioned on the watchlist. Moreover, what's the benefit of having alerts, if not knowing which transaction must be inspected/monitored?
    • The fact that the ALERT is not systematic but conditional, can be documented with an optional relationship.
    • The matching of the transaction with the watchlist is based on some criteria, but the relationship with the alert would be based on the id.

    The ER diagrams show the structure of the entities and the relationships. They do not describe the processes or the behaviors. Typically, with an ERD, you'd use some DFD to explain what data is consumed by the monitoring process that would generate the ALERT records. And the IF would be documented in the flowchart or pseudocode that documents this process. On the other side, nothing prevents you from informally documenting this informally in a comment within your ERD.

    Unrelated remarks:

    • As you have lots of attributes on the relation TRANSACT_WITH, and since a relation is not supposed to have attributes, I understand that it is in reality an associative entity.
    • The matching of the watchlist solely on the base of the name (without even considering the country) might lead to a high number of false positives.
    • UML would allow to constraint the ER-relationship (UML-association) with ER-entity (UML-Class) ALERT, and express the conditionality in a very precise manner.
  • Related