Introduction to Data Models

What are Data Models?

Data Models are abstract representations that define how data is structured, stored and related within an information system. In essence, a data model provides a conceptual framework that describes the relationships between different data elements and the rules that govern them.

These data models are fundamental in the field of the Internet of Things (IoT) or Smart Cities, where we deal with physical devices, measurements, processes, people, etc., and the data model we are using must be able to model all these concepts.

image-20240718-070523.png
Example of a Data Model

Benefits of Data Models

Data models, therefore, give us a uniform representation of all the elements of our system, which implies a series of numerous benefits:

  • Reusability: the ability to model components that are then going to be reusable is a standard practice that saves time and cost.

  • Flexibility: once the model is created, it makes it easy to update, modify or remove elements of the model without having to rework the system.

  • Scalability: simplifies the cloning and modification of devices that are similar or behave in the same way as others that have already been tested.

  • Interoperability: using a data model that is based on standards (JSON, XML, etc.) simplifies that this model can be used in future applications in a simple way.

  • Collaboration: a data model allows predefining links, relationships, actions between components, allowing this to be defined when the model is being created so that different teams can work in parts.

  • Independence of use: a data model allows transparent integration with other systems. A correctly formed model will make it easier to create applications such as analytics on the data.

Types of Data Models

There are several types of data models, including:

  • Hierarchical model: in which the structure the data in a tree-like hierarchy, where each level has a parent-child relationship.

  • Network model: which allows for more complex and flexible relationships between data through graphs that can have multiple relationships.

  • Relational model: which uses tables to represent data and the relationships between them, being the most common in current databases.

  • Object-oriented model: where object-oriented programming concepts are integrated to represent data, such as objects with attributes and methods.

How Data Models are defined

Creating a good data model is critical to the success of any software development project, as it ensures that data is handled efficiently and effectively, supporting both current and future needs, which translates into cost and time savings.

To achieve a good model, the steps that are followed are as follows:

  • Requirements gathering: All business requirements are gathered and it is clearly defined what data needs to be stored and how it will be used.

  • Entity identification: The main entities that are part of the system, such as users, products, orders, etc., are defined.

  • Attribute definition: For each entity, its attributes (characteristics) are defined, such as name, date, measurement value, units, etc.

  • Establishing relationships: Determine how the different entities are related to each other. This includes defining one-to-one, one-to-many, and many-to-many relationships.

  • Normalization: Normalization rules are applied to reduce redundancies and ensure data integrity.

  • Diagramming: Creates entity-relationship diagrams (ERD) to visualize entities and their relationships.

  • Validation: Reviews the model with stakeholders to ensure that it meets all business requirements and is technically correct.

  • Implementation: Once validated, implement the model in the database management system (DBMS) of your choice.