From fa4260ad08b7aefaea3ea7b64f87ddc221c57cc3 Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Mon, 20 Apr 2020 11:27:30 -0700 Subject: Put back Intersex with the closest PATO equivalent These options still disagree with the doc string in the schema.--- bh20sequploader/bh20seq-options.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/bh20sequploader/bh20seq-options.yml b/bh20sequploader/bh20seq-options.yml index da47e1a..7320ecf 100644 --- a/bh20sequploader/bh20seq-options.yml +++ b/bh20sequploader/bh20seq-options.yml @@ -13,6 +13,7 @@ host_age_unit: host_sex: Male: http://purl.obolibrary.org/obo/PATO_0000384 Female: http://purl.obolibrary.org/obo/PATO_0000383 + Intersex: http://purl.obolibrary.org/obo/PATO_0001340 sample_sequencing_technology: Illumina NextSeq 500: http://www.ebi.ac.uk/efo/EFO_0009173 -- cgit v1.2.3 From b8804933e540aa9231b4a3c406553d7df9d97e0e Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Mon, 20 Apr 2020 11:30:09 -0700 Subject: Make doc not contradict option list --- bh20sequploader/bh20seq-schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bh20sequploader/bh20seq-schema.yml b/bh20sequploader/bh20seq-schema.yml index 64008f2..bbcafc8 100644 --- a/bh20sequploader/bh20seq-schema.yml +++ b/bh20sequploader/bh20seq-schema.yml @@ -24,7 +24,7 @@ $graph: jsonldPredicate: _id: http://semanticscience.org/resource/SIO_000115 host_sex: - doc: Sex of the host as defined in NCIT, IRI expected (http://purl.obolibrary.org/obo/NCIT_C20197 (Male), http://purl.obolibrary.org/obo/NCIT_C27993 (Female), http://purl.obolibrary.org/obo/NCIT_C45908 (Intersex), or http://purl.obolibrary.org/obo/NCIT_C17998 (Unknown)) + doc: Sex of the host, IRI expected type: string? jsonldPredicate: _id: http://purl.obolibrary.org/obo/PATO_0000047 -- cgit v1.2.3 From adf76b6c85da9277921cfe4c45df764310d29737 Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Mon, 20 Apr 2020 11:43:47 -0700 Subject: Nicer headings for xxx2 fields and float support --- bh20simplewebuploader/main.py | 25 +++++++++++++++++++------ bh20simplewebuploader/templates/form.html | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 8c5c18c..e31f18b 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -46,8 +46,11 @@ def name_to_label(field_name): """ Turn a filed name like "host_health_status" from the metadata schema into a human-readable label. """ - - return string.capwords(field_name.replace('_', ' ')) + + # May end in a number, which should be set off by a space + set_off_number = re.sub('([0-9])$', r' \1', field_name) + + return string.capwords(set_off_number.replace('_', ' ')) def is_iri(string): """ @@ -66,10 +69,16 @@ def generate_form(schema, options): Each dict either has a 'heading' (in which case we put a heading for a form section in the template) or an 'id', 'label', 'type', and 'required' - (in which case we make a form field in the template). Non-heading dicts - with type 'select' will have an 'options' field, with a list of (name, - value) tuples, and represent a form dropdown element. Non-heading dicts may - have a human-readable 'docstring' field describing them. + (in which case we make a form field in the template). + + Non-heading dicts with type 'select' will have an 'options' field, with a + list of (name, value) tuples, and represent a form dropdown element. + + Non-heading dicts with type 'number' may have a 'step', which, if <1 or + 'any', allows the number to be a float. + + Non-heading dicts may have a human-readable 'docstring' field describing + them. Takes the deserialized metadata schema YAML, and also a deserialized YAML of option values. The option values are keyed on (unscoped) field name in @@ -177,6 +186,10 @@ def generate_form(schema, options): record['type'] = 'text' # HTML input type elif field_type == 'int': record['type'] = 'number' + elif field_type == 'float': + record['type'] = 'number' + # Choose a reasonable precision for the control + record['step'] = '0.0001' else: raise NotImplementedError('Unimplemented field type {} in {} in metadata schema'.format(field_type, type_name)) yield record diff --git a/bh20simplewebuploader/templates/form.html b/bh20simplewebuploader/templates/form.html index 6993cf5..02ae84d 100644 --- a/bh20simplewebuploader/templates/form.html +++ b/bh20simplewebuploader/templates/form.html @@ -238,7 +238,7 @@ {% endfor %} {% else %} - + {% endif %} {% endif %} {% if loop.index == loop.length %} -- cgit v1.2.3 From 3bd4ac02ded5af9a666ad7e99ebf6891bc339636 Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Mon, 20 Apr 2020 11:44:18 -0700 Subject: Support any number of series fields --- bh20simplewebuploader/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index e31f18b..34dc354 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -48,7 +48,7 @@ def name_to_label(field_name): """ # May end in a number, which should be set off by a space - set_off_number = re.sub('([0-9])$', r' \1', field_name) + set_off_number = re.sub('([0-9]+)$', r' \1', field_name) return string.capwords(set_off_number.replace('_', ' ')) -- cgit v1.2.3 From f38b9c6f22b82327df9648938a5a4bcf863d8c41 Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Mon, 20 Apr 2020 11:52:47 -0700 Subject: Use a date picker for any string 'date' --- bh20simplewebuploader/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 34dc354..ceab8a6 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -183,7 +183,13 @@ def generate_form(schema, options): # Make a tuple for each one record['options'].append((name, value)) elif field_type == 'string': - record['type'] = 'text' # HTML input type + if field_name.endswith('date'): + # Use a date picker to generate a good string. + # Comes back YYYY-MM-DD. + record['type'] = 'date' + else: + # Normal text string + record['type'] = 'text' elif field_type == 'int': record['type'] = 'number' elif field_type == 'float': -- cgit v1.2.3