Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ency07/B2B-import/llms.txt

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

The Pre-Engineering Wizard is a public-facing tool available at /wizard that allows industrial prospects to self-qualify their ventilation needs before ever speaking to a sales engineer. Visitors input their space dimensions and environment type, the system performs deterministic aerodynamic calculations in real time, and the result is a diagnostic report — complete with required CFM, equipment category, price estimate, and a materials recommendation — that is simultaneously stored as a scored lead in the ERP.

End-to-End Flow

1

Service and Urgency Selection

The visitor selects the type of service required (fabricacion, venta, mantenimiento, reparacion, or otro) and the commercial urgency level (baja, media, or alta). Urgency affects both the pricing multiplier and the lead score.
2

Physical Dimensions and Environment

The visitor enters the space dimensions (length × width × height in meters) and selects the operational environment type. A live CFM ticker updates at 60 fps as dimensions change, powered by client-side calls to calculateRequiredCfm().
3

Contact Information

The visitor provides their name, company (empresa), job title (cargo), phone, email, and city. The form validates that the phone number matches the Colombian E.164 format and that the email is syntactically valid.
4

Calculations Review

A HUD panel displays the computed CFM, cubic-meter volume, ACH rate, environment severity, and estimated price range in COP and USD — all recalculated live before submission.
5

Submission and ERP Registration

On confirmation, the submitWizardData() Server Action runs. It creates or upserts a clients record, creates or reuses a client_contacts record, creates a scored leads entry, and saves a diagnostic_reports record. The result page shows the diagnostic code and allows the visitor to download a PDF report or send a WhatsApp message to the sales team.

Submission Interface

The wizard accepts the following shape from src/app/actions/wizard.ts:
interface WizardSubmission {
  servicio: "fabricacion" | "venta" | "mantenimiento" | "reparacion" | "otro";
  length: number;
  width: number;
  height: number;
  environment: "heavy_plant" | "data_center" | "mining" | "warehouse" | "default";
  nombre: string;
  empresa: string;
  cargo: string;
  telefono: string;
  email: string;
  ciudad: string;
  urgencia: "baja" | "media" | "alta";
  otroDetalle?: string;
}

Result Interface

After a successful submission, submitWizardData() returns:
interface WizardResult {
  diagnosticCode: string;
  requiredCfm: number;
  cfmCategory: "CRITICAL" | "HIGH" | "STANDARD" | "COMPACT";
  calculatedVolumeM3: number;
  estimatedPriceMinCop: number;
  estimatedPriceMaxCop: number;
  estimatedPriceMinUsd: number;
  estimatedPriceMaxUsd: number;
  materialsRecommendation: string;
  leadId: string;
}
The diagnosticCode is auto-generated by the diagnostic_reports table trigger and printed on the PDF report.

CFM Calculation Engine

CFM is computed by calculateRequiredCfm() in src/utils/engineering.ts, which delegates to the full generateEngineeringReport() engine. The formula applies ASHRAE Air Changes per Hour (ACH) norms per environment type:
CFM = (Volume in cubic feet × ACH / 60) × Pollutant Factor
A pollutant factor of 1.3× is applied for heavy_plant and mining environments due to higher airborne contamination loads.

CFM Categories

CategoryThresholdTypical Use
COMPACT< 2,000 CFMSmall workshops, offices
STANDARD2,000 – 7,999 CFMMedium warehouses, food processing
HIGH8,000 – 14,999 CFMLarge industrial plants
CRITICAL≥ 15,000 CFMHeavy manufacturing, mining, data centers

ACH Reference Values (ASHRAE)

EnvironmentACH Rate
heavy_plant45
data_center30
mininguses heavy_plant factor
warehouse8
default10

Pricing Engine

Pricing is computed by estimatePrice() in src/utils/pricing.ts. Base prices per service type in COP:
ServiceBase Price (COP)
fabricacion$1,200,000
venta$800,000
mantenimiento$300,000
reparacion$500,000
A volume modifier adds +5% per 100 m³ of space, and urgency multipliers are applied on top (alta = ×1.35, media = ×1.10, baja = ×1.00). The final range applies a ±15% deviation to produce a preliminary commercial estimate. Exchange rate is fixed at 1 USD = 4,000 COP.

Materials Recommendations

The materials recommendation is derived deterministically from the environment field:

heavy_plant / mining

Industrial Blower or mushroom extractor (tipo Hongo) with epoxy anticorrosive coating and extruded aluminium blades.

data_center

Air injection system with EPA/HEPA particle filters and acoustic vibration-dampening control.

warehouse / default / other

Multipurpose extractor or high-capacity axial fan with 22-gauge galvanized steel ductwork.

No AI, No Hallucinations

The wizard uses fully deterministic rule engines — no LLMs, no external AI inference calls. calculateRequiredCfm() and estimatePrice() are pure TypeScript functions that produce the same output for the same input every time. This ensures consistent, verifiable results and eliminates hallucination risk for technical and financial estimates.

Security Model

submitWizardData uses supabaseAdmin (Supabase Service Role key) for all database writes because the wizard visitor is unauthenticated. The visitor never has direct database access. All writes happen server-side inside a Next.js Server Action, and RLS policies are bypassed intentionally only at the service-role level.

URL

/wizard?tenant=<code>
Passing ?tenant=<code> loads the white-label branding (logo, primary color, company name) for the corresponding tenant. Pre-populated query parameters ?product=, ?length=, ?width=, ?height=, and ?environment= are also supported to deep-link from the marketing catalog with dimensions pre-filled.

Build docs developers (and LLMs) love