@@ -147,8 +147,8 @@ Sample code ::
147147
148148 >>> from toolkit import Signal
149149 >>> signal_loggin = Signal("LoggedIn") # Creates a new signal
150- >>> @signal_loggin.connect
151- ... def notify_user(username): # Connect the function to signal named signal_loggin
150+ >>> @signal_loggin.connect
151+ ... def notify_user(username): # Connect the function to signal named signal_loggin
152152 ... print("Notify user about new logging through mail")
153153 ...
154154 >>> signal_loggin.send("test_user") # Send the signal from any where in the system
@@ -171,4 +171,34 @@ Sample Code ::
171171 >>> tables = schema.get_tables() # Get all the tables
172172 >>> enum_types = schema.get_enum_types() # Get all the enum types
173173 >>> table = schema.get_table('t1') # Get t1 table
174- >>> table.get_indexes()
174+ >>> table.get_indexes()
175+
176+ fileformats
177+ -----------
178+ validate and transform the given data as per the fileformat specifications.
179+
180+ Given input data is passed through a pipeline of validators. These validators
181+ can check structure and schema, for example are their blank rows or columns, is the data of right type etc.
182+
183+ In return, the client receives a report on processing performed.
184+
185+
186+ Sample code ::
187+
188+ >>> from toolkit import FileFormat
189+ >>> formatter = FileFormat.from_file("fileformats/customer-master.yml")
190+ >>> formatter.process_file("master-files/customer-master/customer-master-20200601.csv")
191+ <Report:status=ACCEPTED #errors=0>
192+
193+ You can use command line tool as well for the validation (this comes along with the package).
194+
195+ Command line tool ::
196+
197+ $ validate-fileformat --help
198+ Usage: validate-fileformat [OPTIONS] FILE
199+ ....
200+ $ validate-fileformat -f fileformats/customer-master.yml customer-master/customer-master-20200601.csv
201+ File validation status: ACCEPTED
202+ ....
203+ $ validate-fileformat -f fileformats/customer-master.yml customer-master/customer-master-20200601.csv -o report.json
204+ File validation status: ACCEPTED
0 commit comments