Clinical Form Templates define the structured data schemas that govern what information is collected during a medical encounter. Each template has an immutableDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/0Crazy-0/ClinicFlow/llms.txt
Use this file to discover all available pages before exploring further.
Code (its natural business key), a human-readable Name and Description, and a JsonSchemaDefinition string — a JSON Schema draft-07 document that the backend uses to validate DynamicClinicalDetail payloads and that the frontend uses to render the appropriate form fields dynamically. Templates are soft-deletable; deactivated templates can no longer be used in new encounters but their existing clinical detail records remain intact.
The
JsonSchemaDefinition field is validated at command time by IJsonSchemaDefinitionValidator.IsValidSchema. Providing a value that is not valid JSON Schema draft-07 causes the FluentValidation step to reject the command with DomainErrors.Validation.InvalidFormat before any domain logic runs. If JsonSchemaDefinition is omitted or whitespace-only, the domain stores an empty schema {}.Commands
CreateClinicalFormTemplate
Type:IRequest<Guid>
Creates a new active clinical form template. The Code must be unique across all templates (including soft-deleted ones) — the repository enforces this constraint. Name is validated for maximum 100 characters; Description for maximum 500 characters.
Parameters
The immutable natural key for this template (e.g.
"BLOOD_PRESS", "DENTAL_ODONTOGRAM"). Must not be empty. After creation, the Code cannot be changed — altering it would break all historical ClinicalDetail records that reference it.A descriptive display name (e.g.
"Blood Pressure Reading"). Must not be empty and must be ≤ 100 characters.A brief explanation of the template’s clinical purpose. Optional; must be ≤ 500 characters if provided.
A JSON Schema draft-07 string defining the form’s field structure, types, and constraints. Validated by
IJsonSchemaDefinitionValidator.IsValidSchema when provided. If omitted or whitespace, the domain stores {} (empty schema). See the example below for a minimal schema.ClinicalFormTemplate.Id as a Guid.
Example JsonSchemaDefinition
Example JsonSchemaDefinition
JsonDataPayload submitted against this template must provide systolic and diastolic as integers within the specified ranges.UpdateClinicalFormTemplate
Type:IRequest (returns Unit)
Updates the Name, Description, and JsonSchemaDefinition of an existing template. The Code is always immutable and cannot be modified. The same IJsonSchemaDefinitionValidator check applies to the new schema.
Parameters
The primary key of the template to update. Must be a non-empty GUID.
Replacement display name. Must not be empty and must be ≤ 100 characters.
Replacement description. Must be ≤ 500 characters if provided.
Replacement JSON Schema draft-07 string. Validated by
IJsonSchemaDefinitionValidator when non-empty.Unit (void).
DeactivateClinicalFormTemplate
Type:IRequest (returns Unit)
Soft-deletes a template, preventing it from being used in new CompleteMedicalEncounter or AddClinicalDetailToMedicalRecord operations. Throws BusinessRuleValidationException with DomainErrors.ClinicalFormTemplate.AlreadyInactive if the template is already deactivated.
Parameters
The template to deactivate. Must be a non-empty GUID.
Unit (void).
ReactivateClinicalFormTemplate
Type:IRequest (returns Unit)
Restores a previously deactivated template, making it available again for new clinical detail submissions. Throws BusinessRuleValidationException with DomainErrors.ClinicalFormTemplate.AlreadyActive if the template is not currently deactivated.
Parameters
The template to reactivate. Must be currently soft-deleted.
Unit (void).
Queries
GetClinicalFormTemplateById
Type:IRequest<ClinicalFormTemplateDto>
Fetches a single template by its primary key (UUID).
Parameters
The primary key of the template. Must be a non-empty GUID.
ClinicalFormTemplateDto or throws EntityNotFoundException.
GetClinicalFormTemplateByCode
Type:IRequest<ClinicalFormTemplateDto>
Fetches a template by its immutable Code business key. Preferred over ID-based lookup when referencing templates by code from external systems or frontend form renderers.
Parameters
The unique business key code (e.g.
"BLOOD_PRESS"). Must not be empty. Case-sensitive.ClinicalFormTemplateDto or throws EntityNotFoundException.
GetAllActiveClinicalFormTemplates
Type:IRequest<IReadOnlyList<ClinicalFormTemplateDto>>
Returns all templates that are currently active (not soft-deleted). Used to populate template selection lists in the encounter UI.
ClinicalFormTemplateDto records.
GetAllClinicalFormTemplates
Type:IRequest<IReadOnlyList<ClinicalFormTemplateDto>>
Returns the complete template catalogue, including soft-deleted entries. Intended for administrative management views.
ClinicalFormTemplateDto records (active + inactive).
Response Shape
ClinicalFormTemplateDto
The unique identifier of the template.
The immutable natural key used to reference this template in clinical detail records (e.g.
"BLOOD_PRESS"). Changing this value would break historical records.The display name of the template (e.g.
"Blood Pressure Reading").A brief description of the template’s clinical purpose.
The raw JSON Schema draft-07 string. Used by the backend to validate
JsonDataPayload values submitted against this template and by the frontend to render the appropriate input form. Defaults to {} when no schema was provided at creation.true if the template has been deactivated (soft-deleted) and is no longer available for new encounters; false if currently active.