Giter VIP home page Giter VIP logo

franck-mahieu / datasets-toolbox Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 25 KB

datasets-toolbox are some scripts usefull to generate, transfom and valid large dataset files, not openable with editor because too large. datasets-toolbox provide also a ping script.

License: MIT License

JavaScript 100.00%
toolbox json transform-data json-data json-parsing big-data-processing ping-launch ping jsonlines jsonl

datasets-toolbox's Introduction

Descriptions

datasets-toolbox are some scripts usefull to generate, transfom and valid large dataset files, not openable with editor because too large. datasets-toolbox provide also a ping script.

Generate

generateDatasetFile

Script to generate a dataset file with a configurable number of rows, using data retrieved randomly in the json file passed as a parameter

How to launch

Launch this command, just update the outputFilePath, inputFilePath and expectedLines env var :

cross-env outputFilePath= inputFilePath= expectedLines= node scripts/generate/generateDataset.js

Without specifying these variables, the scripts will generate a file of 100,000 lines, using the default data sample, and generate the file in dataset/generate folder.

Transform

convertCsvToJson

Convert csv file with ";" delimiters to an array of json in an other file, like this :

description;title
value;title
value2;title2

to

[
    {"description":"value","title":"title"},
    {"description":"value2","title":"title2"},
]

How to launch

Launch this command, just update the sourcePath env var :

cross-env sourcePath=pathToYourFileWithoutExtension node scripts/transform/convertCsvToJson.js

Without sourcePath env var, the script choose the file in dataset folder

convertObjectByLineToObjectsArray

Convert an object by line file to an array of json in an other file, like this :

{"key": "value"}
{"key2": "value2"}

to

[
    {"key": "value"},
    {"key2": "value2"}
]

How to launch

Launch this command, just update the sourcePath env var :

cross-env sourcePath=pathToYourFileWithoutExtension node scripts/transform/convertObjectByLineToObjectsArray.js

Without sourcePath env var, the script choose the file in dataset folder

transformEveryObjectsInObjectByLine

Transform every objects in object by line file to transformed object by line, in an other file, like this (for an add date in each object example) :

{"key": "value"}
{"key2": "value2"}

to

{"key":"value","date":"2021-01-25T20:19:31.967Z"}
{"key2":"value2","date":"2021-01-25T20:19:31.968Z"}

How to launch

Launch this command, just update the sourcePath env var :

cross-env sourcePath=pathToYourFileWithoutExtension node scripts/transform/transformEveryObjectsInObjectByLine.js

Validation

detectErrorInJsonByLine

Iterate over each objects in object by line file to log every not parsable objects, like

{"key": "value"}
{"key2": "value2", "key3":}
{"key4": "value2", "key5":}

generate this logs :

This line is not parsable : {"key2": "value2", "key3":}
This line is not parsable : {"key4": "value2", "key5":}

How to launch

Launch this command, just update the sourcePath env var :

cross-env sourcePath=pathToYourFileWithoutExtension node scripts/validation/detectErrorInJsonByLine.js

Without sourcePath env var, the script choose the file in dataset folder

detectErrorInJsonsInsideFolder

Iterate over each json file in specified folder to log every not parsable files, like

How to launch

Launch this command, just update the sourcePath env var :

cross-env sourcePath=pathToYourFolder node scripts/validation/detectErrorInJsonsInsideFolder.js

Without sourcePath env var, the script choose the folder folderOfJsons in dataset folder

Ping

Launch a ping with your nodeJS network configuration. It's helpfull if you want to check the connectivity between your node env and an ip (to test network configuration)

How to launch

Launch this command, just update the ipToPing env var :

cross-env ipToPing= node ./scripts/ping.js

Without ipToPing env var, the script ping google DNS by default

How to use

Clone or download the project, in root folder, launch this command to get dependencies

npm install

You can test all scripts with npm start scripts available in package.json file or with commands in "How to use" sections.

Others

Don't hesistate to make issue or PR if needed. You can contact me on tweeter : @Franck_Mahieu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.