Giter Club home page Giter Club logo

python-parser's Introduction


Parser Using Python

A simple parser built using python as part of a hiring process.
Report Bug


Table of Contents
  1. About The Project
  2. Getting Started
  3. Testing
  4. Usage Instructions


About The Project

A simple parser built using python as part of a hiring process. It supports parser data from CSV & XML to JSON. The project was built in a way that makes it easy to extend to a new format, and easy to add new features. I've decided to only use built-in modules in my task, as I wanted to show my algorithmic skills (especially in the XML Parser) alongside my software engineering skills.

Built With


Getting Started

The application is very simple, which means that initializing it won't be a big deal.

Prerequisites

  • Python3

Installation

  1. Clone the repo
git clone https://github.com/Samuel-Sorial/Python-Parser.git
  1. Go to the clone directory
cd Python-Parser

Testing

After initializing the project from the previous section, simply run:

python3 -m unittest discover test

Note: if your default python version is python3, you can only type python instead of python3



Usage Instructions

Parse to json

python3 parser.py <format> <files>
  • Supported formats are:
    • CSV
    • XML
  • Output format: json

Sample xml usage:

python3 parser.py xml ./data/xml/customer1.xml

Sample xml output: customer.json file that contains:

{
  "transaction": {
    "date": "2021-12-07",
    "customer": {
      "name": "Shirish Suchak",
      "address": "1429  Joyce Street",
      "phone": "252-414-7396",
      "units": {
        "vehicle": {
          "make": "Honda",
          "vin_number": "WDBFA63E7RF125264",
          "id": "V1824"
        }
      },
      "id": "ID1011200"
    }
  },
  "file_name": "xml/customer1.xml"
}

Sample csv usage:

python3 parser.py csv ./data/csv/vehicles.csv

Sample xml output: vehicles.json file that contains:

[
  {
    "id": "V3015",
    "make": "Chevrolet",
    "vin_number": "1HGFA16548L016469",
    "owner_id": "ID9857"
  },
  {
    "id": "V2014",
    "make": "Honda",
    "vin_number": "1G6KD57Y46U180996",
    "owner_id": "ID9857"
  },
  {
    "id": "V1475",
    "make": "Ford",
    "vin_number": "2HKYF18575H574967",
    "owner_id": "ID5410"
  },
  {
    "id": "V786",
    "make": "Nissan",
    "vin_number": "2GTEK13M481177784",
    "owner_id": "ID6651"
  }
]

python-parser's People

Contributors

samuel-sorial avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.