Skip to main content

Lex SNM1 Network Import

Overview

Lex will be sending their supplier files daily via SFTP to keep their network in sync with the network presented to them on the ViSN platform, these files act more like network updates. The 2 files are SNM1 and SNM2. The SNM2 file is a full file containing all the suppliers in the network, the SNM1 file is a delta file containing only the changes to the network. In this document, we will be discussing the SNM1 file.

download sample Lex SNM1-delta-ancillary-prices file.

Lex SNM1-delta-ancillary-prices file

Column PositionLex FieldsViSN FieldsDatatypeValidationMax lengthMandatoryDefault ValueExample
1RecordTypeIGNORE
2RecordVersionNoIGNORE
31LinkSiteReferenceDI Group ID - DI Supplier IDstringA-Z, 0-9 and all special characters (50 bc that’s 30 for Group ID + 20 for Supplier ID)
^[a-zA-Z0-9_-]+-[a-zA-Z0-9_-]+$
50YNot Available
4SchemeOperatorNetworkIGNORE
5ServiceCentreNameIGNORE
6ExpectedAirConditioningCoolantPPLAir Conditioning Coolantstring0-9 and . (decimal number)6Y4.5
7ExpectedAntiFreezePPLAnti-Freezestring0-9 and . (decimal number)6Y4.5
8ExpectedAutomaticTransmissionFluidPPLAutomatic Transmission Fluidstring0-9 and . (decimal number)6Y4.5
9ExpectedAxleOilPPLAxle Oilstring0-9 and . (decimal number)6Y4.5
10ExpectedBrakeClutchFluidPPLBrake Fluidstring0-9 and . (decimal number)6Y4.5
11ExpectedGearboxOilMineralPPLGearbox Oil Mineralstring0-9 and . (decimal number)6Y4.5
12ExpectedGearboxOilSyntheticPPLGearbox Oil Syntheticstring0-9 and . (decimal number)6Y4.5
13ExpectedMineralOilPPLMineral Oilstring0-9 and . (decimal number)6Y4.5
14ExpectedPowerSteeringFluidPPLPower Steering Fluidstring0-9 and . (decimal number)6Y4.5
15ExpectedSemiSyntheticOilPPLSemi Synthetic1string0-9 and . (decimal number)6Y4.5
16ExpectedSuspensionFluidPPLSuspension Fluidstring0-9 and . (decimal number)6Y4.5
17ExpectedSyntheticOilPPLSynthetic1string0-9 and . (decimal number)6Y4.5
18ServiceMaintenanceRepairService And Maintenance Repairstring1 or 0Y1
19MotTestStationMOTstring1 or 0Y1
20TyresTyresstring1 or 0Y0
2124HourCallOutIGNORE
22CourtesyCarIGNORE
23DeliveryAndCollectionIGNORE
24BreakdownAssistanceBreakdownstring1 or 0Y1
25SupplierNotesIGNORE
26CollectionDeliveryPostCodeAreaIGNORE
27WorkBookingIntroductionFeeIGNORE
28InvoiceCommissionValueRebate AmountstringDecimal Number (format should be 00.00)6N0.0010.25
29InvoiceCommission%Rebate PercentagestringDecimal Number (format should be 00.00)-Y
301LinkSiteReference2IGNORE
31ExpectedLongLifeOilPPLLong Life Oilstring0-9 and . (decimal number)6Y4.5
32ExpectedHydraulicPPLHydraulic Fluidstring0-9 and . (decimal number)6No4.5
33ExpectedRefrigeratorPPLRefrigerator Coolantstring0-9 and . (decimal number)6Y4.5
34ExpectedAdBluePPLAdBluestring0-9 and . (decimal number)6No4.5
35ExpectedOtherFluidPPLOther Fluidstring0-9 and . (decimal number)6No4.5
36InspectionsIGNORE

Process of importing LEX SNM1 file

SNM1 import process is designed to ensure data consistency and integrity, especially in relation to the full network file, SNM2. Below is an overview of how the SNM1 import process works:

1. Scheduled Imports

Both the SNM2 and SNM1 files are processed through scheduled tasks. The SNM2 import runs first, as it contains the complete set of supplier data. After a predefined interval, the SNM1 import is executed. The file names are renamed to SNM1-delta-ancillary-prices.csv and SNM2-full-labour-rates.csv respectively.

2. Validation Against Existing Data

  • Each row in the SNM1 file contains a key field, 1LinkSiteReference, which is a composite of the DI Group ID and DI Supplier ID in the format:
    DI Group ID - DI Supplier ID.
  • During the SNM1 import, the system checks whether the supplier identified by this composite key exists in the database.

3. Dependency on SNM2 Updates

To ensure accuracy, SNM1 updates are only applied to suppliers that were successfully imported or updated as part of the SNM2 import on the same day. This safeguard ensures that delta updates do not inadvertently introduce discrepancies.

4. Field Updates

For each validated and eligible supplier, only the fields explicitly mentioned below from the SNM1 file are updated.

Column PositionLex Fields nameMap to ViSN Fields (Description)Data level
6ExpectedAirConditioningCoolantPPLAir Conditioning CoolantLease-Supplier
7ExpectedAntiFreezePPLAnti FreezeLease-Supplier
8ExpectedAutomaticTransmissionFluidPPLAutomatic Transmission FluidLease-Supplier
9ExpectedAxleOilPPLAxle OilLease-Supplier
10ExpectedBrakeClutchFluidPPLBrake FluidLease-Supplier
11ExpectedGearboxOilMineralPPLGearbox Oil MineralLease-Supplier
12ExpectedGearboxOilSyntheticPPLGearbox Oil SyntheticLease-Supplier
13ExpectedMineralOilPPLMineral OilLease-Supplier
14ExpectedPowerSteeringFluidPPLPower Steering FluidLease-Supplier
15ExpectedSemiSyntheticOilPPLSemi Synthetic1Lease-Supplier
16ExpectedSuspensionFluidPPLSuspension FluidLease-Supplier
17ExpectedSyntheticOilPPLSynthetic1Lease-Supplier
18ServiceMaintenanceRepairService And Maintenance RepairLease-Supplier
19MotTestStationMOTLease-Supplier
20TyresTyresLease-Supplier
24BreakdownAssistanceBreakdownLease-Supplier
28InvoiceCommissionValueRebate AmountLease-Supplier
29InvoiceCommission%Rebate PercentageLease-Supplier
31ExpectedLongLifeOilPPLLong Life OilLease-Supplier
32ExpectedHydraulicPPLHydraulic FluidLease-Supplier
33ExpectedRefrigeratorPPLRefrigerator CoolantLease-Supplier
34ExpectedAdBluePPLAdBlueLease-Supplier
35ExpectedOtherFluidPPLOther FluidLease-Supplier

This process ensures that delta updates from SNM1 files are applied in a controlled and reliable manner, aligning with the most recent supplier data provided in the SNM2 file.

Preparation

  1. Create a new branch with Jira task number in the branch name

  2. Delete all the files within the importFiles folder to prevent accidental import of incorrect files

  3. Create a folder with the current sprint number

  4. Copy the SNM1 file that needs to be imported along with SNM2 file into the folder

  5. Go to package.json , find the line validate:lex-snm1-network-import

  6. Modify --file with the relative path of the file and modify --secondaryFile with the relative path of the SNM2 file

  7. Save the package.json

Validating locally

  1. in a terminal run npm run build

  2. in a terminal run npm run validate:lex-snm1-network-import

  3. If there are no errors, push the code

Validating in workflow

  1. Go to Action of Import-manger

  2. Find <Environment> - on-demand-import

  3. Select the branch that was created for this import

  4. Enter script name as validate:lex-snm1-network-import

  5. Leave Overrides empty

Importing the file

  1. If the validation has passed

  2. Go to Action of Import-manger

  3. Find <Environment> - on-demand-import

  4. Select the branch that was created for this import

  5. Enter script name as validate:lex-snm1-network-import

  6. Enter --persist in Overrides field

Importing and Validating the file via cloud run

Creating Schedulers for validating the Lex SNM1 delta file

  1. Go to Cloud Scheduler and select the CREATE JOB

Setup Required

A Scheduler should be created cloud scheduler with the following parameters

  • Name: lex-snm1-network-validation
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • TimeZone: GMT London
  • Target type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-snm1-network-import
  • HTTP method: POST
  • Auth header: select OIDC token
  • Service account: cloud-run-import-customer-contract
  • body: a JSON object including the following parameters

JSON object for lex-snm1-network-validation scheduler

{
"persist": "false",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "SNM1-delta-ancillary-prices.csv",
"secondaryImportFileName": "SNM2-full-labour-rates.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"leaseId": "QJKgdjS4I02sEia4yTne"
}

Create scheduler for validating Lex SNM1 delta file

Creating Schedulers for importing the Lex SNM1 delta file

  1. Go to Cloud Scheduler and select the CREATE JOB

Setup Required

A Scheduler should be created cloud scheduler with the following parameters

  • Name: lex-snm1-network-import
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • TimeZone: GMT London
  • Target type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-snm1-network-import
  • HTTP method: POST
  • Auth header: select OIDC token
  • Service account: cloud-run-import-customer-contract
  • body: a JSON object including the following parameters

JSON object for lex-snm1-network-import scheduler

{
"persist": "true",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "SNM1-delta-ancillary-prices.csv",
"secondaryImportFileName": "SNM2-full-labour-rates.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"leaseId": "QJKgdjS4I02sEia4yTne"
}

Create scheduler for validating Lex SNM1 delta file

Preparation:

  1. Bucket name is biddirect-2.appspot.com and it will vary for higher envs and the file path should be imports/fileDrop, where you can drop the 2 CSV files named "SNM1-delta-ancillary-prices.csv" and "SNM2-full-labour-rates.csv". This action will place the file in the specified location within the designated bucket.

Validation:

  1. Go to Cloud Scheduler
  2. Run lex-snm1-network-validation job (job name could be different on other env)
logs in cloud

Importing:

  1. Go to Cloud Scheduler
  2. Run lex-snm1-network-import job (job name could be different on other env)
logs in cloud

Testing

  1. For respective DI Group ID - DI Supplier ID service units, the fields mentioned in the table under "4. Field Updates" should be updated with the values from the SNM1 file.
Status: Approved
Category: Protected
Authored By: Sohan on Nov 21, 2024