Skip to content

Commit

Permalink
Use the megaqc format instead of ISO 馃槩
Browse files Browse the repository at this point in the history
  • Loading branch information
multimeric committed May 27, 2019
1 parent 4e10c08 commit 2cf9a1f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions megaqc/commands.py
Expand Up @@ -19,6 +19,7 @@
HERE = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.join(HERE, os.pardir)
TEST_PATH = os.path.join(PROJECT_ROOT, 'tests')
MEGAQC_DATE_FORMAT = "%Y-%m-%d, %H:%M"


@click.command()
Expand Down Expand Up @@ -152,12 +153,16 @@ def initdb():
db.metadata.create_all()
print('Initialized the database.')

def megaqc_date_type(arg):
return datetime.strptime(arg, MEGAQC_DATE_FORMAT)

@click.option(
'--date',
default=None,
help='Custom date to be stored for all the MultiQC files provided. Should be provided in ISO 8601 format',
type=datetime.fromisoformat
help='Custom date to be stored for all the MultiQC files provided. Should be provided in the date format {}'.format(
MEGAQC_DATE_FORMAT
),
type=megaqc_date_type
)
@click.command( context_settings=dict( help_option_names = ['-h', '--help'] ) )
@click.argument('json_files', type=click.Path(exists=True), nargs=-1, required=True, metavar="<multiqc_data.json>" )
Expand Down Expand Up @@ -203,5 +208,5 @@ def upload(json_files, date):

# Patch in the date provided on the CLI
if date is not None:
multiqc_json_dump['config_creation_date'] = date.strftime("%Y-%m-%d, %H:%M")
multiqc_json_dump['config_creation_date'] = date.strftime(MEGAQC_DATE_FORMAT)
multiqc_megaqc.multiqc_api_post(multiqc_json_dump)

0 comments on commit 2cf9a1f

Please sign in to comment.