The ingestion game CLI
Project description
The Ingestion Game
The Ingestion Game consists of:
- A data file with a varying number of entries containing some data. It is shaped as a CSV where each row has
an arbitrary number of
key=value
pairs separated by comma.key1=value1,key2=value2 key3=value3 key4=value4,key5=value5,key6=value6
- Not all
key
s are always important! Each time we play the game, the keys to process can be different. The rest are just considered noise. We want to ingest all the important keys. - All important keys are always going to be present in the data rows of the input file.
- Each
key
supports a specific data type. We should only process rows where the values match the expected datatype of each key. - Each row consists of an Entity of a given type. The type will be informed as
type=T
in the data.type
is always considered as an important key and we can assume it is astr
. - Entities have hierarchies defined in the games' rules. For example, given the rule
A -> B
, we cannot process any Entity of typeB
until we have processed all Entities of typeA
.
Your task is to win the Ingestion Game with the following rules:
- The important keys are
id:int
,name:str
,food:str
andtype:str
. - Entities follow the hierarchy
A -> B -> C
.
The solution must be coded in Python and you can use any public libraries. The solution must be an CLI that outputs
the processed data to stdout
in CSV format following the important keys, e.g.,:
id,name,food,type
1,levy,veggies,A
2,lima,pizza,A
3,john,fish,B
We are going to provide a data file with the keys and hierarchies mentioned above, but your CLI should accept any
important keys and hierarchies as inputs. You can see an example on input data in the provided input.txt
.
🤓 We value in the solution
- Good software design
- Proper documentation
- Compliance to Python standards and modern usages (e.g.: PEP8)
- Proper use of data structures
- Ergonomy of the command line interface
- Setup/Launch instructions if required
Solution
The call to script should be
Run
Tests
pytest -vvv
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ingestion_game-0.1.0.tar.gz
(18.7 kB
view hashes)
Built Distribution
Close
Hashes for ingestion_game-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f668021fc1c295aa9d1b67b79e212dc9f3e21cc39ea54b1694f242c1409100 |
|
MD5 | 0785767d3f50b45f5cbeb8eb5b9dd10f |
|
BLAKE2b-256 | dccc4e7f4182142244e99757a47cf7724ed2c24d5e98e541a9e2f0efe569d383 |