Coder Social home page Coder Social logo

4lessandrodev / process-csv-and-xml Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 153 KB

process csv and xml file to mongo or local

Shell 3.45% TypeScript 96.55%
csv stream mongodb localhost processing read-file-from-csv read-xml xml-parser csv-parser simple-project

process-csv-and-xml's Introduction

Process csv and xml files

Process and save data to mongo

The challenge

The user can upload two different types of files. xml or csv. Both files contain the same types of content, but represented according to their respective format. The system allows the user to upload either of these two files. The system should process the two files and normalize them to json format. When normalizing, the user will inform if he wants to save the result locally or in a database in the cloud.

Read file, transform data and save to local or to mongo atlas

example

How to run this project

  • Create an account on mongo atlas Link Here
  • Set your credential on .env file
  • Run the test yarn test
  • Run the project yarn dev

Route POST

destination: Local or Mongo

POST http://localhost:3000/upload

BODY form-data

the sample files you can find on src/data

{
  file: sample.csv
  destination: Local
}

PAYLOAD

{
  "success": true
}

Route GET

the get route find documents on mongodb

GET http://localhost:3000/upload?limit=2
{
  {
    "docs": [
        {
            "_id": "624a0077642d164fd3dcda65",
            "Transaction": "Invoice0000001",
            "Amount": "1,000.00",
            "CurrencyCode": "USD",
            "TransactionDate": "20/02/2019 12:33:16",
            "Status": "Approved"
        },
        {
            "_id": "624a0077642d164fd3dcda66",
            "Transaction": "Invoice0000002",
            "Amount": "300.00",
            "CurrencyCode": "USD",
            "TransactionDate": "21/02/2019 02:04:59",
            "Status": "Failed"
        }
    ]
  },
  "count": 12
}

Preview

example

Use on your project

  • Copy the files to your project
  • Call the function processFileService
  • You can provide a file from uploaded

Any question feel free to message me Linkedin

References

process-csv-and-xml's People

Contributors

4lessandrodev avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.