1.1.10 • Published 3 years ago

sql-csv-insert-processor v1.1.10

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Install and use it

Pipeline to process and build SQL SCRIPT from mapping .CSV

Build Status

> npm i sql-csv-insert-processor

Testing sql-csv-insert-processor

const SETUP: ProcessorSetup[] = [
  {
    result_file_name: 'exported/annotations/ann_box',
    laggards_file_name: 'exported/annotations/for_review_ann_box',
    fields: {
      attachment_url: 'image_url_address',
      instructions: 'details',
      with_labels: 'with_labels',
    },
    IS_INSERT_IGNORE: true,
    TABLE_NAME: 'ann_box',
    csv_file_path: './src/assets/Trainingset.ai - box annotation example - demo.csv',
    encoding: 'win1250',
    PreProcessor: [
      /**
       * @param {*} data represents current row data
       * @param {requestCallback} PushToResult Run the function which save the row data into first result file
       * @param {requestCallback} PushToLaggards Run the function which save the row data into first result file
       * @param {[]} currentResultArray Includes the curretly saved data (for results) to be passed to PostProcessor
       * @param {[]} currentLaggardArray Includes the curretly saved data (for laggards) to be passed to PostProcessor
       */
      (data, callbackSaveResult, callbackSaveLaggards, currentResultArray, currentLaggardArray) => {
        console.log(data);

        callbackSaveResult(data);
        callbackSaveLaggards(data);

        /* 
        if (currentResultArray.includes( ... )) {
          ...
         } 
         */

        return data;
      },
    ],
    PostProcessor: [   
      (arrayResult, arrayLaggards) => {
        // YOU CAN CHECK OR EDIT THEM BEFORE BUILDIND FILES

        return [arrayResult, arrayLaggards];
      },
    ],    
  },
];

convert

image

into this

INSERT IGNORE INTO ann_box (details,image_url_address,with_labels) VALUES
( "Draw a box around each car","https://i.imgur.com/OUyDzS2.jpg","TRUE" )
,( "Draw a box around each car","https://i.imgur.com/OUyDzS2.jpg","TRUE" )
,( "Draw a box around each device 2","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )
,( "Draw a box around each device 3","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )
,( "Draw a box around each device 4","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )
1.1.9

3 years ago

1.1.8

3 years ago

1.1.10

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago