Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pabloeferreyra/Turnero/llms.txt

Use this file to discover all available pages before exploring further.

Patient profiles are the central reference point for all clinical activity in Turnero. Every appointment, clinical visit, allergy record, vaccination, growth measurement, and medication entry is linked back to a single patient. Profiles store demographic information, contact details, insurance data, and blood type, and they serve as the entry point to the full patient history. The entire Patients module — including creating, viewing, editing, and searching — requires the Medico role.

The Patient entity

public class Patient : BaseEntity
{
    public string?  Name            { get; set; }  // Required
    public string?  Dni             { get; set; }  // 6–10 characters, required
    public DateTime BirthDate       { get; set; }  // Required, displayed as dd/MM/yyyy
    public ContactInfo? ContactInfo { get; set; }
    public string?  SocialWork      { get; set; }  // Health insurance / Obra Social
    public string?  AffiliateNumber { get; set; }  // Insurance membership number
    public BloodType BloodType      { get; set; }  // Enum
    // Navigation properties
    public ICollection<Turn>?        Turns               { get; set; }
    public ICollection<Visit>?       Visits              { get; set; }
    public ICollection<Vaccines>?    Vaccines            { get; set; }
    public ICollection<Allergies>?   Allergies           { get; set; }
    public ICollection<PermMed>?     PermMeds            { get; set; }
    public ICollection<GrowthChart>? GrowthCharts        { get; set; }
    public ParentsData?              Parent              { get; set; }
    public PersonalBackground?       PersonalBackground  { get; set; }
    public PerinatalBackground?      PerinatalBackground { get; set; }
    public CongErrors?               CongErrors          { get; set; }
}

Field reference

FieldTypeValidationDescription
IdGuidAuto-generatedPrimary key (from BaseEntity)
NamestringRequiredPatient’s full name
Dnistring6–10 chars, requiredNational identity document number
BirthDateDateTimeRequiredDate of birth (dd/MM/yyyy display format)
SocialWorkstringHealth insurance plan name
AffiliateNumberstringInsurance membership / affiliate number
BloodTypeBloodTypeEnumABO + Rh blood group
ContactInfoContactInfoOwned object with phone, email, address
Patient.Dni is stored as string? with a [StringLength(10, MinimumLength = 6)] validation constraint, allowing for leading zeros or formatted document numbers. The PatientDTO used in list responses maps Dni to int? for compact serialisation. When creating or editing a patient, submit Dni as a string in the form body; the list endpoint will return it as an integer.

BloodType enum

The BloodType enum covers all eight standard ABO/Rh combinations. The [Display] attribute drives the dropdown labels in the UI.
Enum valueDisplay label
A_PositiveA+
A_NegativeA-
B_PositiveB+
B_NegativeB-
AB_PositiveAB+
AB_NegativeAB-
O_PositiveO+
O_NegativeO-

ContactInfo sub-object

ContactInfo is a separate owned entity linked one-to-one with a patient. It carries all contact details:
FieldTypeDescription
IdGuidAuto-generated primary key
PhonestringTelephone number
EmailstringEmail address
AddressstringStreet address
CitystringCity
PostalCodestringPostal / ZIP code

Role restriction

The entire PatientsController is decorated with [Authorize(Roles = RolesConstants.Medico)]. Only authenticated users assigned the Medico role can access any patient management endpoint. Front-desk (Ingreso) and unauthenticated users will receive a 403 response.

Patient list

The patient index (GET /Patients) displays a DataTables grid. Data is loaded via an AJAX initialization call:
POST /Patients/InitializePatients
Content-Type: application/x-www-form-urlencoded

draw=1&start=0&length=25&Columns[1][search][value]=García
The Columns[1][search][value] parameter drives a server-side search against patient name and DNI. The response follows the standard DataTables envelope:
{
  "draw": 1,
  "recordsFiltered": 3,
  "recordsTotal": 3,
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "María García",
      "dni": 28471032,
      "birthDate": "15/04/1990",
      "socialWork": "OSDE",
      "affiliateNumber": "A-00123456"
    }
  ]
}

Creating a patient

Open the creation form:
GET /Patients/Create
This returns the _Create partial view with a pre-populated BloodType dropdown built from the enum’s display names. Submit the form:
POST /Patients/Create
Content-Type: application/x-www-form-urlencoded

Name=María+García&Dni=28471032&BirthDate=1990-04-15
&SocialWork=OSDE&AffiliateNumber=A-00123456&BloodType=0
BloodType is submitted as the integer value of the enum member (e.g. 0A_Positive). Returns 200 OK on success, 400 Bad Request if the model state is invalid, or 409 Conflict on a data layer exception.

Editing a patient

Load the edit form with the current values pre-filled:
GET /Patients/Edit/{id}
Submit the updated record:
PUT /Patients/Edit
Content-Type: application/x-www-form-urlencoded

Id=3fa85f64-...&Name=María+García&Dni=28471032&BirthDate=1990-04-15
&SocialWork=Swiss+Medical&AffiliateNumber=B-00987654&BloodType=0
Requires the anti-forgery token header (__RequestVerificationToken).

Patient detail view

GET /Patients/Details/{id}
The detail page loads the patient record and enriches the view with two additional pieces of data:
  • ViewBag.ParentsData — the linked ParentsData record (father’s name, blood type, occupation; mother’s name, blood type, occupation; number of siblings).
  • ViewBag.Age — a human-readable age string calculated at request time.

Age calculation logic

The CalcularEdad helper converts BirthDate to a display string using the smallest meaningful unit:
ConditionReturned string
≥ 1 year"N año(s)" — e.g. "3 años"
≥ 1 month (< 1 year)"N mes(es)" — e.g. "8 meses"
≥ 7 days (< 1 month)"N semana(s)" — e.g. "2 semanas"
< 7 days"N día(s)" — e.g. "5 días"
The calculation uses exact calendar arithmetic: years are resolved by AddYears, months by AddMonths, and weeks/days by a simple TimeSpan.Days difference, each stepped back by one if the addition overshoots today’s date.
The detail view is the starting point for navigating to all clinical sub-modules (visits, allergies, vaccines, growth charts, permanent medications, and background histories). Each is rendered as a lazy-loaded DataTables panel within the same page.

Relationships to other modules

A Patient is the parent record for the following clinical entities:

Appointments (Turns)

Zero or more Turn records, each representing a scheduled or walk-in visit.

Clinical Visits

Zero or more Visit records documenting diagnoses, treatments, and evolution notes.

Allergies

A list of Allergies entries with severity, type, and occurrence frequency.

Vaccines

A collection of Vaccines records with the vaccine name and date applied.

Growth Charts

Longitudinal GrowthChart entries tracking weight, height, head circumference, and BMI.

Permanent Medications

A list of PermMed entries for chronic or ongoing prescriptions.

Personal Background

A single PersonalBackground record with boolean flags for common medical history items.

Perinatal Background

A single PerinatalBackground record with birth measurements and gestational data.

Parents Data

A single ParentsData record with father’s and mother’s name, blood type, and occupation.

Congenital Errors

A single CongErrors record with neonatal screening results for metabolic conditions.

Build docs developers (and LLMs) love