Skip to content

Commit

Permalink
Put outputs into version folder and name files with version name
Browse files Browse the repository at this point in the history
  • Loading branch information
regner committed Apr 21, 2017
1 parent d0929f5 commit 11f55fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions aodb/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@


from os import mkdir
from os.path import exists

from . import exporters
from.resources import RESOURCES

Expand All @@ -12,23 +15,28 @@ def get_input_path(name: str, input_folder: str = DEFAULT_INPUT) -> str:
return f'{input_folder}{name}.txt'


def get_output_path(name: str, output_folder: str = DEFAULT_OUTPUT) -> str:
return f'{output_folder}{name}.' + '{}'
def get_output_version_folder(version: str, output_folder: str = DEFAULT_OUTPUT) -> str:
return f'{output_folder}{version}/'


def get_output_path(name: str, version: str, output_folder) -> str:
return f'{output_folder}{version}-{name}.' + '{}'


def generate_exports(version: str):
"""Generates the database conversions."""
# Load the raw data
# Run export

print('Generating exports...')

output_folder = get_output_version_folder(version)
if not exists(output_folder):
mkdir(output_folder)

for resource in RESOURCES:
name = resource['name']
print(f'Exporting {name}...')

input_path = get_input_path(name)
output_path = get_output_path(name)
output_path = get_output_path(name, version, output_folder)

exporters.XmlExporter(input_path, output_path).genreate_export()
exporters.JsonExporter(input_path, output_path).genreate_export()
Expand Down
Empty file removed inputs/.gitkeep
Empty file.
File renamed without changes.

0 comments on commit 11f55fd

Please sign in to comment.