Creating Models

Introduction

Models are the foundation of your data structure in Cnidarity. They define the types of content you'll create and manage within your research projects. This guide will walk you through the process of creating effective models for your research data.

What are Models?

Models are templates that define the structure of your research data. They consist of a collection of attributes (fields) that describe what information should be stored. Each model represents a specific type of entity in your research, such as:

  • Research Subjects (e.g., Patients, Species, Specimens)
  • Experimental Units (e.g., Samples, Experiments, Trials)
  • Research Outputs (e.g., Observations, Measurements, Results)
  • Administrative Items (e.g., Protocols, Equipment, Locations)
Models in Cnidarity are similar to tables in a database, but they are more flexible, allowing you to adapt their structure to fit your specific research needs.

Planning Your Models

Before creating models, it's important to plan your data structure carefully. Consider the following:

Identify Key Entities

Start by identifying the main entities in your research. These will become your primary models. Ask yourself what distinct "things" you're collecting data about.

Determine Relationships

Consider how your models relate to each other. For example:

  • Does a Sample belong to a Patient?
  • Can an Experiment have multiple Observations?
  • Does a Protocol apply to multiple Experiments?

Outline Attributes

For each model, list the attributes (fields) you need to capture. Consider the type of data for each attribute (text, number, date, etc.) and whether it should be required.

Example: Planning a "Sample" Model

  • sample_id (Text, Required): Unique identifier
  • collection_date (Date, Required): When the sample was collected
  • location (Text): Where the sample was collected
  • type (Select, Required): Type of sample (blood, tissue, etc.)
  • volume (Number): Volume of the sample in mL
  • storage_condition (Text): How the sample is stored
  • notes (Long Text): Additional information

Relationships: Belongs to a Patient, Has many Test Results

Creating a Model

Once you've planned your data structure, you can create models in your project:

  1. Navigate to your project dashboard
  2. Click on "Models" in the sidebar navigation
  3. Click the "Create Model" button in the top-right corner
  4. Fill out the model details form (described below)
  5. Click "Create Model" to save your new model

Note that projects have a limit on the number of models they can contain, based on their subscription tier. If you've reached your limit, you'll need to upgrade your project's tier to create additional models.

Required Model Details

When creating a model, you'll need to provide the following information:

  • Model Name: The name that will be used to identify your model (maximum 32 characters)
  • Short Description: A concise description that appears in lists and overviews (maximum 128 characters)
  • Detailed Description: A comprehensive explanation of the model's purpose and usage

Only users with Project Admin privileges can create and manage models. Regular users and View Only users can view models but cannot create or modify them.

Model Settings

After creating a model, you can configure additional settings that affect how the model functions:

Model Restriction

You can restrict the model so that only project administrators can create, edit, or delete records of this model. This is useful for sensitive or fundamental data that should be carefully controlled.

To restrict a model, check the "Restrict to Project Admins" option when creating or editing the model.

Display Attributes

After adding attributes to your model, you can select which attributes will be displayed in record listings. This helps users quickly identify records by showing the most relevant information.

To set display attributes, navigate to the model's edit page after you've added attributes to the model.

Be careful when restricting models to administrators only. This will prevent other project members from creating or editing records of this type, even if they have general record creation privileges.

Managing Existing Models

The Models section in your project provides a comprehensive view of all your data models with the following capabilities:

Browsing Models

The Models page displays a table with all models in your project, showing:

  • Model name
  • Description
  • Number of attributes (fields)
  • Action buttons for editing models, adding attributes, and viewing records

Editing a Model

To edit a model's details:

  1. Navigate to the Models section of your project
  2. Find the model you want to edit
  3. Click the Edit (pencil) icon in the actions column
  4. Update the model's name, short description, or detailed description
  5. Click "Save Changes" to apply your updates

Managing Attributes

Each model can have multiple attributes (fields) that define what information is stored:

  • To add attributes, click the "+" icon next to a model in the Models list
  • To view or manage existing attributes, click on the model name to go to its detail page
  • The model detail page provides a complete view of all attributes and allows you to add, edit, or delete them

Viewing Records

To view all records of a specific model:

  1. Click on the model name in the Models list, or
  2. Click the View (eye) icon in the actions column

From the records view, you can browse, search, filter, create, edit, and delete records based on your permission level.

Deleting a Model

To delete a model:

  1. Navigate to the model's edit page
  2. Click the "Delete Model" button at the bottom of the form
  3. Confirm the deletion in the confirmation dialog

Deleting a model will permanently delete all records of that model and any relationships associated with it. This action cannot be undone, so use it with extreme caution.

Best Practices

Follow these guidelines to create effective models for your research data:

  • Use Clear Names: Choose descriptive names for models and attributes that clearly communicate their purpose
  • Keep Models Focused: Each model should represent a single, cohesive concept in your research
  • Plan for Relationships: Consider how models will relate to each other before creating them
  • Start Simple: Begin with essential attributes and add more as needed
  • Use Required Fields Judiciously: Only make attributes required if they are truly essential
  • Add Helpful Descriptions: Provide clear descriptions for models and attributes to help users understand their purpose

Pro Tip

Map out your data model on paper or using a diagram tool before implementing it in Cnidarity. This can help you identify potential issues and optimize your structure.

Next Steps

Now that you understand how to create models, learn more about: