Skip to main content

Overview

Quality Hub GINEZ operates across 40+ production branches throughout Mexico. The system is designed to handle multi-location production tracking, quality control, and reporting with location-specific data segregation and aggregation.
All locations (sucursales) are defined in lib/production-constants.ts and used throughout the application for filtering, reporting, and batch number generation.

Location List

The system supports the following 40 production locations:

Regional Distribution

Central Mexico

  • ACTOPAN
  • ATITALAQUIA
  • ATLACOMULCO
  • IXMIQUILPAN
  • MIXQUIAHUALA
  • PACHUCA 1
  • PACHUCA 2
  • TIZAYUCA
  • TULANCINGO 1
  • TULANCINGO 2
  • ZUMPANGO 1
  • ZUMPANGO 2

Puebla & Surroundings

  • AMOZOC
  • APIZACO
  • CHOLULA
  • PUEBLA 1
  • PUEBLA 2
  • PUEBLA 3
  • TEHUACAN
  • TEZIUTLAN

Bajío Region

  • CELAYA
  • IRAPUATO
  • QUERETARO 1
  • QUERETARO 2
  • QUERETARO 3

Western Mexico

  • GUADALAJARA
  • MORELIA

Southern Mexico

  • CUAUTLA
  • OAXACA 1
  • OAXACA 2

Southeast

  • CANCUN 1
  • CANCUN 2
  • CEIBA
  • MERIDA
  • PLAYA DEL CARMEN
  • VILLAHERMOSA

Gulf Coast

  • HUEJUTLA
  • VERACRUZ

Administrative

  • CEDIS (Distribution Center)
  • CORPORATIVO (Corporate HQ)

Complete Location Reference

#LocationAcronymRegion
1ACTOPANACTHidalgo
2AMOZOCAMOPuebla
3APIZACOAPZTlaxcala
4ATITALAQUIAATIHidalgo
5ATLACOMULCOATLEstado de México
6CANCUN 1CAN1Quintana Roo
7CANCUN 2CAN2Quintana Roo
8CEIBACEIQuintana Roo
9CELAYACELGuanajuato
10CHOLULACHOPuebla
11CUAUTLACUAMorelos
12GUADALAJARAGDLJalisco
13HUEJUTLAHUEHidalgo
14IRAPUATOIRAGuanajuato
15IXMIQUILPANIXMHidalgo
16MERIDAMERYucatán
17MIXQUIAHUALAMIXHidalgo
18MORELIAMORMichoacán
19OAXACA 1OAX1Oaxaca
20OAXACA 2OAX2Oaxaca
21PACHUCA 1PAC1Hidalgo
22PACHUCA 2PAC2Hidalgo
23PLAYA DEL CARMENPDCQuintana Roo
24PUEBLA 1PUE1Puebla
25PUEBLA 2PUE2Puebla
26PUEBLA 3PUE3Puebla
27QUERETARO 1QR01Querétaro
28QUERETARO 2QR02Querétaro
29QUERETARO 3QR03Querétaro
30TEHUACANTEHPuebla
31TEZIUTLANTEZPuebla
32TIZAYUCATIZHidalgo
33TULANCINGO 1TUL1Hidalgo
34TULANCINGO 2TUL2Hidalgo
35VERACRUZVERVeracruz
36VILLAHERMOSAVHMTabasco
37ZUMPANGO 1ZUM1Estado de México
38ZUMPANGO 2ZUM2Estado de México
39CEDISCEDISDistribution
40CORPORATIVOCORPCorporate

Location Acronyms

Each location has a unique acronym used in batch/lot number generation:
export const SUCURSAL_ACRONYMS: Record<string, string> = {
  "ACTOPAN": "ACT",
  "AMOZOC": "AMO",
  "APIZACO": "APZ",
  "ATITALAQUIA": "ATI",
  "ATLACOMULCO": "ATL",
  "CANCUN 1": "CAN1",
  "CANCUN 2": "CAN2",
  "CEIBA": "CEI",
  "CELAYA": "CEL",
  "CHOLULA": "CHO",
  "CUAUTLA": "CUA",
  "GUADALAJARA": "GDL",
  "HUEJUTLA": "HUE",
  "IRAPUATO": "IRA",
  "IXMIQUILPAN": "IXM",
  "MERIDA": "MER",
  "MIXQUIAHUALA": "MIX",
  "MORELIA": "MOR",
  "OAXACA 1": "OAX1",
  "OAXACA 2": "OAX2",
  "PACHUCA 1": "PAC1",
  "PACHUCA 2": "PAC2",
  "PLAYA DEL CARMEN": "PDC",
  "PUEBLA 1": "PUE1",
  "PUEBLA 2": "PUE2",
  "PUEBLA 3": "PUE3",
  "QUERETARO 1": "QR01",
  "QUERETARO 2": "QR02",
  "QUERETARO 3": "QR03",
  "TEHUACAN": "TEH",
  "TEZIUTLAN": "TEZ",
  "TIZAYUCA": "TIZ",
  "TULANCINGO 1": "TUL1",
  "TULANCINGO 2": "TUL2",
  "VERACRUZ": "VER",
  "VILLAHERMOSA": "VHM",
  "ZUMPANGO 1": "ZUM1",
  "ZUMPANGO 2": "ZUM2",
  "CEDIS": "CEDIS",
  "CORPORATIVO": "CORP"
};

Batch Number Format

Batch/lot numbers are automatically generated using the location acronym:
YYYYMMDD-{ACRONYM}-{PRODUCT_CODE}-###
Components:
  • YYYYMMDD - Production date (e.g., 20240315)
  • ACRONYM - Location acronym (e.g., PAC1)
  • PRODUCT_CODE - Product identifier (e.g., LIMLIM)
  • ### - Sequential number (001, 002, 003…)
// PACHUCA 1 producing LIMLIM on March 15, 2024
"20240315-PAC1-LIMLIM-001"

// CANCUN 2 producing SUASUE on March 15, 2024
"20240315-CAN2-SUASUE-001"

// QUERETARO 3 producing TRALIM on December 31, 2025
"20251231-QR03-TRALIM-005"

Location-Based Features

All modules support location-based filtering:
Users can filter records by location to view:
  • Production logs for specific branch
  • Conformity rates by location
  • Quality trends per site

2. Data Segregation

While data is stored centrally, the UI can be configured for location-specific views:
// Optional: Restrict user to specific location
const userLocation = profile.sucursal // From user profile

const records = await supabase
  .from('bitacora_produccion')
  .select('*')
  .eq('sucursal', userLocation) // Filter by user's location
  .order('fecha_fabricacion', { ascending: false })
Current implementation allows all users to see all locations. Location-based access restrictions can be added via RLS policies if needed.

Adding New Locations

To add a new production location to the system:
1

Update Constants File

Edit lib/production-constants.ts:
// 1. Add to SUCURSALES array
export const SUCURSALES = [
  // ... existing locations ...
  "NEW_LOCATION",
];

// 2. Add acronym mapping
export const SUCURSAL_ACRONYMS: Record<string, string> = {
  // ... existing mappings ...
  "NEW_LOCATION": "NEWLOC",
};
2

Update UI Components

Location dropdown components automatically read from SUCURSALES, but verify:
import { SUCURSALES } from '@/lib/production-constants'

<Select>
  {SUCURSALES.map(suc => (
    <SelectItem key={suc} value={suc}>
      {suc}
    </SelectItem>
  ))}
</Select>
3

Test Batch Generation

Verify batch numbers generate correctly:
npm run dev
# Navigate to Bitácora → Create new record
# Select new location and verify batch format
4

Update Documentation

Document the new location in:
  • Internal wiki/procedures
  • User training materials
  • This documentation page
Do not modify or remove existing locations unless absolutely necessary, as it may affect historical data integrity.

Location-Specific Configurations

Option 1: Centralized Configuration

All locations use the same quality standards and product definitions (current implementation). Pros:
  • Consistent quality standards across all sites
  • Simplified maintenance
  • Easier compliance and auditing
Cons:
  • Less flexibility for location-specific requirements
  • Cannot accommodate regional variations

Option 2: Location-Specific Standards (Advanced)

For organizations requiring location-specific configurations:
export const LOCATION_CONFIGS: Record<string, LocationConfig> = {
  "PACHUCA 1": {
    timezone: "America/Mexico_City",
    specialRequirements: ["ISO-9001", "FSSC-22000"],
    customStandards: {
      "LIMLIM": { min: 1.5, max: 1.6 } // Tighter tolerance
    }
  },
  "CANCUN 1": {
    timezone: "America/Cancun",
    specialRequirements: ["ISO-9001"],
    customStandards: {} // Use defaults
  }
  // ... more locations
}
Only implement location-specific configurations if truly needed. Most organizations benefit from standardization.

Multi-Site Reporting

Aggregated Reports

Generate company-wide reports across all locations:
const aggregatedData = await supabase
  .from('bitacora_produccion')
  .select('sucursal, tamano_lote, codigo_producto')
  .gte('fecha_fabricacion', startDate)
  .lte('fecha_fabricacion', endDate)

// Group by location
const byLocation = aggregatedData.reduce((acc, record) => {
  if (!acc[record.sucursal]) {
    acc[record.sucursal] = { volume: 0, batches: 0 }
  }
  acc[record.sucursal].volume += record.tamano_lote
  acc[record.sucursal].batches += 1
  return acc
}, {})

Location Comparison

Compare performance metrics across locations:

Production Volume

Compare total liters/kg produced per location over time period

Quality Conformance

Percentage of conforming batches by location

Product Mix

Distribution of product families by location

Efficiency Metrics

Average batch size, production rate, and throughput

Geographic Visualization (Future Enhancement)

For advanced deployments, consider adding geographic visualization:
import { MapContainer, Marker, Popup } from 'react-leaflet'

const LOCATION_COORDINATES: Record<string, [number, number]> = {
  "PACHUCA 1": [20.1220, -98.7316],
  "CANCUN 1": [21.1619, -86.8515],
  "GUADALAJARA": [20.6597, -103.3496],
  // ... more coordinates
}

function ProductionMap({ data }: { data: ProductionRecord[] }) {
  return (
    <MapContainer center={[23.6345, -102.5528]} zoom={5}>
      {data.map(record => (
        <Marker
          key={record.id}
          position={LOCATION_COORDINATES[record.sucursal]}
        >
          <Popup>
            <strong>{record.sucursal}</strong><br />
            Volume: {record.tamano_lote} L<br />
            Status: {record.conformity}
          </Popup>
        </Marker>
      ))}
    </MapContainer>
  )
}

Best Practices

Naming Consistency

  • Always use official location names from SUCURSALES
  • Never use variations or abbreviations in data entry
  • Validate location input against constant list

Data Integrity

  • Enforce location foreign key constraints
  • Validate batch numbers follow correct format
  • Audit location changes in production records

Performance

  • Index sucursal column for fast filtering
  • Use location-based partitioning for large datasets
  • Cache location list in frontend (rarely changes)

User Experience

  • Pre-select user’s default location
  • Show location in batch number preview
  • Provide location-based quick filters

Next Steps

Environment Variables

Complete your environment configuration

Supabase Setup

Set up location-aware database policies

Build docs developers (and LLMs) love