Skip to content
This repository was archived by the owner on May 22, 2018. It is now read-only.

Hackfest #5

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
49 changes: 49 additions & 0 deletions hackfest/Product Data Lungo Tavolo - Pants.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Category,Subcategory 1,Subcategory 2,Subcategory 3,Subcategory 4,Subcategory 5,Subcategory 6
Productname,wrap and strap pants,"=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP101a.jpg"")",,,,
Producttype,Pants,White,Mid,,,
Suggested Sex,Unisex,Donna,Uomo,,,
Ref.,LT SP 101,,,,,
Series,Summer,,,,,
Limited Edition,1/400,,,,,
Designer,Sergio Perruci,,,,,
Year,2015,,,,,
In Collaboration with,cws,,,,,
Description,Pants in Italian linen with a double wrap belted waist in signature black double satin. Wear them with the belt wrapped twice around your waist and let the extra length of the ribbon flow loosely along your leg,"=image(""https://s-media-cache-ak0.pinimg.com/564x/26/b3/a5/26b3a584ecbe16bd5dbb00c36895265f.jpg"")","=image(""https://s-media-cache-ak0.pinimg.com/originals/4c/c8/74/4cc874b4f7f8dc25fa92138a2eed94a4.png"")",,,
Detail,wrap front panel detail raw cut on the grain taped edges and hems sandwich bonded belt double satin ribbon invisible selvedge ribbon width 2.5 cm ribbon length from waist 40 cm rectangular double ring buckle raw stainless steel nickel free hem label at strap tip entirely made in Italy,"=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP101g.jpg"")","=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP101c.jpg"")",,,
Fabric 1,Linen,100%,,,,
Origin,Italy,,,,,
Colour 1,White,"=image (""http://www.lungotavolo.it/wp-content/uploads/2016/05/colwhite.jpg"")",,,,
Pantone,PANTONE 11-4001 TPG,,,,,
HEX/HTML,EFF0F1,,,,,
Colour 2,Khaki,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colkhaki.jpg"")",,,,
Pantone,PANTONE 15-1216 TPX,,,,,
HEX/HTML,C0B290,,,,,
Colour 3,Stone,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colgrey.jpg"")",,,,
Pantone,PANTONE PQ-CoolGray8C,,,,,
HEX/HTML,888B8D,,,,,
Ref.,LT SP 101,,,,,
Series,Print,,,,,
Limited Edition,1/400,,,,,
Designer,Sergio Perruci,,,,,
Year,2016,,,,,
In Collaboration with,cws,,,,,
Background Colour 3 ,Stripes,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/09/colstripe.jpg"")",,,,
Pantone,PANTONE 11-4001 TPG,,,,,
HEX/HTML,EFF0F1,,,,,
Pantone,PANTONE 19-0000 TPG,,,,,
HEX/HTML,454546,,,,,
Background Colour 1 ,Dots,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/09/colpois.jpg"")",,,,
Pantone,PANTONE 11-4001 TPG,,,,,
HEX/HTML,EFF0F1,,,,,
Pantone,PANTONE 19-0000 TPG,,,,,
HEX/HTML,454546,,,,,
Sizes Available,XS:waist:74cm,S:waist:80cm,M:waist:84cm,L:waist:88cm,XL:waist:92cm,XXL:waist:96cm
Price,EUR 270,USD 289,GBP 229,CAD 389,,
Aesthetic,#Elegant,#Leisure,#Italian,#Minimalism,#Zen,
Quality Trait,"=""Made in Italy""",Fair Labour,Sustainable,Verified Product,,
Quality Seal,"=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/666115-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580362-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580361-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/204428-200.png"")",,
Quality Statement,Produced in Italy according to Italian Law.,Produced under fair labour conditions according International Labour Organization. Excelling standards according to internal code of ethics.,"Produced under ecologically sustainable conditions according to the statues of rainforest Alliance, Certified Supply Chain. Business auditited and advised by Eco Age Ltd",This Garment was designed to inspire you. Believe in the beauty of imagination - unapolagetically! Have the courage to be who you want to be. This will set you free. ,,
Designed by,Sergio Perruci,"=image(""https://s-media-cache-ak0.pinimg.com/originals/1b/cd/ce/1bcdce55fba1809a7639b5e2235f068b.png"")",CWS,"=image(""https://s-media-cache-ak0.pinimg.com/originals/8d/3b/cc/8d3bcc1b1b148d4f741cc19303a35820.png"")",,
Country of Production,Italy,"=image (""https://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Flag_of_Italy.svg/2000px-Flag_of_Italy.svg.png"")",,,,
Designed Studio,10144 Turin,"Via Treviso, 45","=image(""https://s-media-cache-ak0.pinimg.com/564x/91/70/13/9170135385ce2441ad75970fc18d408d.jpg"")","=image(""https://s-media-cache-ak0.pinimg.com/564x/6b/ce/b9/6bceb98a5d7620cac2374534e3dbfb1b.jpg"")",,
Produced in,12051 Alba,,"=image(""https://s-media-cache-ak0.pinimg.com/originals/e0/01/86/e0018641c80d305614bf19643425cd26.png"")","=image(""http://www.anselmaitalia.com/img_sito/testata/homepage/ristorante-italia_05.jpg"")",,
33 changes: 33 additions & 0 deletions hackfest/Product Data Lungo Tavolo - Skirt.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Category,Subcategory 1,Subcagetory 2,Subcagetory 3,Subcategory 4,Subcategory 5
Productname,wrap and strap skirt,"=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP104a.jpg"")",,,
Producttype,Skirt,Stone,Mid,,
Suggested Sex,Unisex,Donna,Uomo,,
Collection,LT SP 104,,,,
Series,Summer,,,,
Limited Edition,1/400,,,,
Designer,Sergio Perruci,,,,
Year,2015,,,,
In Collaboration with,cws,,,,
Description,a skirt in Italian linen with a double wrap belted waist in signature black double satin wear it with the belt wrapped twice around your waist and let the extra length of the ribbon flow loosely along your leg,"=image(""https://s-media-cache-ak0.pinimg.com/originals/87/f5/0b/87f50be844c989171fdd531d9468204a.png"")","=image(""https://s-media-cache-ak0.pinimg.com/564x/3f/8a/5c/3f8a5c2d4ce602af1968fb0a3d501241.jpg"")",,
Detail,wrap front panel detail raw cut on the grain taped edges and hems sandwich bonded belt double satin ribbon invisible selvedge ribbon width 2.5 cm ribbon length from waist 40 cm rectangular double ring buckle raw stainless steel nickel free hem label at strap tip entirely made in Italy,"=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP104d.jpg"")","=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP104e.jpg"")",,
Fabric 1,Linen,100%,Pure,,
Origin,Italy,,,,
Colour 1,White,"=image (""http://www.lungotavolo.it/wp-content/uploads/2016/05/colwhite.jpg"")",,,
Pantone,PANTONE 11-4001 TPG,,,,
HEX/HTML,EFF0F1,,,,
Colour 2,Khaki,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colkhaki.jpg"")",,,
Pantone,PANTONE 15-1216 TPX,,,,
HEX/HTML,C0B290,,,,
Colour 3,Stone,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colgrey.jpg"")",,,
Pantone,PANTONE PQ-CoolGray8C,,,,
HEX/HTML,888B8D,,,,
Sizes Available,Short,Mid,Long,,
Price,EUR 190,USD 219,GBP 169,CAD 279,
Aesthetic,#Elegant,#Leisure,#Italian,#Minimalism,#Zen
Quality Trait,"=""Made in Italy""",Fair Labour,Sustainable,Verified Product,
Quality Seal,"=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/666115-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580362-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580361-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/204428-200.png"")",
Quality Statement,Produced in Italy according to Italian Law.,Produced under fair labour conditions according International Labour Organization. Excelling standards according to internal code of ethics.,"Produced under ecologically sustainable conditions according to the statues of rainforest Alliance, Certified Supply Chain. Business auditited and advised by Eco Age Ltd",This Garment was designed to inspire you. Believe in the beauty of imagination - unapolagetically! Have the courage to be who you want to be. This will set you free. ,
Designed by,Sergio Perruci,"=image(""https://s-media-cache-ak0.pinimg.com/originals/1b/cd/ce/1bcdce55fba1809a7639b5e2235f068b.png"")",CWS,"=image(""https://s-media-cache-ak0.pinimg.com/originals/8d/3b/cc/8d3bcc1b1b148d4f741cc19303a35820.png"")",
Country of Production,Italy,"=image (""https://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Flag_of_Italy.svg/2000px-Flag_of_Italy.svg.png"")",,,
Designed Studio,10144 Turin,"Via Treviso, 45","=image(""https://s-media-cache-ak0.pinimg.com/564x/91/70/13/9170135385ce2441ad75970fc18d408d.jpg"")","=image(""https://s-media-cache-ak0.pinimg.com/564x/6b/ce/b9/6bceb98a5d7620cac2374534e3dbfb1b.jpg"")",
Produced in,12051 Alba,,"=image(""https://s-media-cache-ak0.pinimg.com/originals/e0/01/86/e0018641c80d305614bf19643425cd26.png"")","=image(""http://www.anselmaitalia.com/img_sito/testata/homepage/ristorante-italia_05.jpg"")",
45 changes: 45 additions & 0 deletions hackfest/Product Data Lungo Tavolo - Top.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Category,Subcategory 1,Subcagetory 2,Subcagetory 3,Subcategory 4,Subcategory 5,Subcategory 6
Productname,drop and strap top,"=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP106a.jpg"")",,,,
Producttype,Top,Khaki,,,,
Sugessted Sex,Women,Donna,,,,
Collection,LT SP 106,,,,,
Series,Summer,,,,,
Limited Edition,1/400,,,,,
Designer,Sergio Perruci,,,,,
Year,2015,,,,,
In Collaboration with,cws,,,,,
Description,a scarf top in Italian linen with a belt in signature black double satin wear it with the belt fastened at the back of your waist and let the extra length of the ribbon flow loosely behind you,"=image(""https://s-media-cache-ak0.pinimg.com/originals/0f/50/a6/0f50a6ed9c7162cfc157693969232ac4.png"")",,,,
Detail,"wrap front panel detail
raw cut on the grain
taped edges and hems
sandwich bonded belt
double satin ribbon
invisible selvedge
ribbon width 2.5 cm
ribbon length from waist 40 cm
rectangular double ring buckle
raw stainless steel
nickel free
hem label at strap tip
entirely made in Italy","=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP106e.jpg"")","=image(""http://www.lungotavolo.it/wp-content/uploads/2015/12/LTSP106c.jpg"")",,,
Fabric 1,Linen,100%,Pure,,,
Origin,Italy,,,,,
Colour 1,White,"=image (""http://www.lungotavolo.it/wp-content/uploads/2016/05/colwhite.jpg"")",,,,
Pantone,PANTONE 11-4001 TPG,,,,,
HEX/HTML,EFF0F1,,,,,
Colour 2,Khaki,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colkhaki.jpg"")",,,,
Pantone,PANTONE 15-1216 TPX,,,,,
HEX/HTML,C0B290,,,,,
Colour 3,Stone,"=image(""http://www.lungotavolo.it/wp-content/uploads/2016/05/colgrey.jpg"")",,,,
Pantone,PANTONE PQ-CoolGray8C,,,,,
HEX/HTML,888B8D,,,,,
Size,One Size,,,,,
Price,EUR 105,USD 120,GBP 90,CAD 180,,
Aesthetic,#Elegant,#Leisure,#Italian,#Minimalism,#Zen,
Quality Trait,"=""Made in Italy""",Fair Labour,Sustainable,Verified Product,,
Quality Seal,"=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/666115-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580362-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/580361-200.png"")","=image(""https://d30y9cdsu7xlg0.cloudfront.net/png/204428-200.png"")",,
Quality Statement,Produced in Italy according to Italian Law.,Produced under fair labour conditions according International Labour Organization. Excelling standards according to internal code of ethics.,"Produced under ecologically sustainable conditions according to the statues of rainforest Alliance, Certified Supply Chain. Business auditited and advised by Eco Age Ltd",This Garment was designed to inspire you. Believe in the beauty of imagination - unapolagetically! Have the courage to be who you want to be. This will set you free. ,,
Designed by,Sergio Perruci,"=image(""https://s-media-cache-ak0.pinimg.com/originals/1b/cd/ce/1bcdce55fba1809a7639b5e2235f068b.png"")",CWS,"=image(""https://s-media-cache-ak0.pinimg.com/originals/8d/3b/cc/8d3bcc1b1b148d4f741cc19303a35820.png"")",,
Country of Production,Italy,"=image (""https://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Flag_of_Italy.svg/2000px-Flag_of_Italy.svg.png"")",,,,
Designed Studio,10144 Turin,"Via Treviso, 45","=image(""https://s-media-cache-ak0.pinimg.com/564x/91/70/13/9170135385ce2441ad75970fc18d408d.jpg"")","=image(""https://s-media-cache-ak0.pinimg.com/564x/6b/ce/b9/6bceb98a5d7620cac2374534e3dbfb1b.jpg"")",,
Produced in,12051 Alba,,"=image(""https://s-media-cache-ak0.pinimg.com/originals/e0/01/86/e0018641c80d305614bf19643425cd26.png"")","=image(""http://www.anselmaitalia.com/img_sito/testata/homepage/ristorante-italia_05.jpg"")",,
Binary file added hackfest/Product Data Lungo Tavolo.xlsx
Binary file not shown.
105 changes: 105 additions & 0 deletions hackfest/lungo_tavolo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
from argparse import ArgumentParser
from logging import getLogger, Formatter, DEBUG
from logging.handlers import SysLogHandler
from bigchaindb_driver import BigchainDB
from json import dumps as json_dumps
from time import strftime, gmtime


class Provenance(object):
def __init__(self, log, bdb_ip, bdb_port, public_key, private_key,
file_path):
self.bdb = BigchainDB('http://{0}:{1}'.format(bdb_ip, bdb_port))
self.keypair = {
'private_key': private_key,
'public_key': public_key
}
self.file_path = file_path
self.logger = log
# end __init__

def start(self):
# open the csv file, every file is an asset
asset = {}
asset['asset_class'] = 'lungo_tavolo_product'
with open(self.file_path) as fh:
# ignore the headers for now
fh.readline()
for line in fh:
columns = line.split(',')
# sanitize the columns, remove null strings
new_columns = []
for cell in columns:
if cell != '':
cell = cell.rstrip('\r\n')
new_columns.append(cell)
# end if
# end for
# define the asset
# remove '.' from the column[0] as mongo does not allow '.'
# in key fields: http://stackoverflow.com/questions/28664383/mongodb-not-allowing-using-in-key
new_columns[0] = new_columns[0].replace('.', '')
asset[new_columns[0]] = ','.join(new_columns[1:])
# end for
self.logger.debug(json_dumps(asset))
# end with
# defin the metadata
asset_metadata = {
'from_file': self.file_path,
'create_at': strftime('%Y-%m-%d_%H:%M:%S', gmtime()),
}
# send to bdb
self.send_to_bdb(asset, asset_metadata)
# end start

def send_to_bdb(self, asset, metadata):
bdb_asset = {
'data': asset
}
prepared_creation_tx = self.bdb.transactions.prepare(
operation='CREATE',
signers=self.keypair['public_key'],
asset=bdb_asset,
metadata=metadata
)
fulfilled_tx = self.bdb.transactions.fulfill(
prepared_creation_tx,
private_keys=self.keypair['private_key']
)
self.bdb.transactions.send(fulfilled_tx)
self.logger.debug(fulfilled_tx['id'])
# end send_to_bdb
# end class Provenance


if __name__ == '__main__':
# argument parsing
parser = ArgumentParser(description='BDB/LungoTavolo')
req_group = parser.add_argument_group('required arguments')
req_group.add_argument('--bdb-ip', type=str, required=True,
help='bdb hostname/ip address')
req_group.add_argument('--bdb-port', type=int, required=True,
help='bdb port number')
req_group.add_argument('--public-key', type=str, required=True,
help='lungo tavolo public key')
req_group.add_argument('--private-key', type=str, required=True,
help='lungo tavolo private key')
req_group.add_argument('--file', type=str, required=True,
help='path to csv file')
args = parser.parse_args()
# set up logging
logger = getLogger('provenance_service')
logger.setLevel(DEBUG)
# local syslog
local_formatter = Formatter(
"%(name)s %(threadName)s %(levelname)s -- %(message)s",
datefmt='%Y-%m-%d %H:%M:%S')
local_syslog = SysLogHandler(address='/dev/log',
facility=SysLogHandler.LOG_SYSLOG)
local_syslog.setFormatter(local_formatter)
logger.addHandler(local_syslog)

provenance = Provenance(logger, args.bdb_ip, args.bdb_port, args.public_key,
args.private_key, args.file)
provenance.start()
# end main
Loading