A simple parser built using python as part of a hiring process.
Report Bug
Table of Contents
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.
The application is very simple, which means that initializing it won't be a big deal.
- Python3
- Clone the repo
git clone https://github.com/Samuel-Sorial/Python-Parser.git
- Go to the clone directory
cd Python-Parser
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
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"
}
]