DatasetProcessing » Historie » Verze 1
Petr Hlaváč, 2020-05-05 09:13
1 | 1 | Petr Hlaváč | h1. DatasetProcessing |
---|---|---|---|
2 | |||
3 | Složka obsahuje implementace processoru pro jednotlivé datasety. Processory jsou dynamicky importovány je tedy proto nutné dodržet pojemnování *"dataset-name"Processor.py*. |
||
4 | |||
5 | Je velmi žádoucí aby crawler pro stažení souboru používal funkci *CSVutils.export_data_to_csv(filename, date_dict)*. |
||
6 | |||
7 | Po implementování metody je nutné změnit *Return False* na *Return True* |
||
8 | |||
9 | h2. Generovaný Processor |
||
10 | |||
11 | <pre> |
||
12 | from Utilities.CSV import CSVDataLine, CSVutils |
||
13 | |||
14 | def process_file(filename): |
||
15 | """ |
||
16 | Method that take path to crawled file and outputs date dictionary using method: |
||
17 | CSVutils.export_data_to_csv(filename, date_dict) |
||
18 | Date dictionary is a dictionary where keys are dates in format ddmmYYYYhh (0804201815) |
||
19 | and value is dictionary where keys devices (specified in configuration file) |
||
20 | and value is CSVDataLine.CSVDataLine with device,date and occurrence |
||
21 | |||
22 | Args: |
||
23 | filename: name of processed file |
||
24 | |||
25 | Returns: |
||
26 | False if not implemented |
||
27 | True when implemented |
||
28 | """ |
||
29 | #with open(filename, "r") as file: |
||
30 | print("You must implements process_file method first!") |
||
31 | #CSVutils.export_data_to_csv(filename, date_dict) |
||
32 | return False |
||
33 | </pre> |