From 9cd33ddac3d6848c5443962d66494635feadef51 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 9 Sep 2024 14:06:31 -0500 Subject: Initialise samples uploads * Move existing code to new module * Rework the UI: create new templates * Rework the routes: Select species and populations before attempting an upload. --- uploader/templates/samples/base.html | 12 ++ uploader/templates/samples/index.html | 21 ++++ uploader/templates/samples/list-samples.html | 114 ++++++++++++++++++ uploader/templates/samples/select-population.html | 117 ++++-------------- uploader/templates/samples/select-species.html | 30 ----- uploader/templates/samples/upload-failure.html | 27 ----- uploader/templates/samples/upload-progress.html | 22 ---- uploader/templates/samples/upload-samples.html | 139 ---------------------- uploader/templates/samples/upload-success.html | 18 --- 9 files changed, 173 insertions(+), 327 deletions(-) create mode 100644 uploader/templates/samples/base.html create mode 100644 uploader/templates/samples/index.html create mode 100644 uploader/templates/samples/list-samples.html delete mode 100644 uploader/templates/samples/select-species.html delete mode 100644 uploader/templates/samples/upload-failure.html delete mode 100644 uploader/templates/samples/upload-progress.html delete mode 100644 uploader/templates/samples/upload-samples.html delete mode 100644 uploader/templates/samples/upload-success.html (limited to 'uploader/templates/samples') diff --git a/uploader/templates/samples/base.html b/uploader/templates/samples/base.html new file mode 100644 index 0000000..291782b --- /dev/null +++ b/uploader/templates/samples/base.html @@ -0,0 +1,12 @@ +{%extends "populations/base.html"%} + +{%block lvl3_breadcrumbs%} + +{%block lvl4_breadcrumbs%}{%endblock%} +{%endblock%} diff --git a/uploader/templates/samples/index.html b/uploader/templates/samples/index.html new file mode 100644 index 0000000..7c88c01 --- /dev/null +++ b/uploader/templates/samples/index.html @@ -0,0 +1,21 @@ +{%extends "samples/base.html"%} +{%from "flash_messages.html" import flash_all_messages%} +{%from "species/macro-select-species.html" import select_species_form%} + +{%block title%}Populations{%endblock%} + +{%block pagetitle%}Populations{%endblock%} + + +{%block contents%} +{{flash_all_messages()}} + +
+

Here, you can upload the samples/individuals that were used in your + experiments.

+

Since the samples are linked to specific species and populations, we will + need to first select them in the next few steps.

+ + {{select_species_form(url_for("species.populations.samples.index"), species)}} +
+{%endblock%} diff --git a/uploader/templates/samples/list-samples.html b/uploader/templates/samples/list-samples.html new file mode 100644 index 0000000..a29dc1c --- /dev/null +++ b/uploader/templates/samples/list-samples.html @@ -0,0 +1,114 @@ +{%extends "samples/base.html"%} +{%from "flash_messages.html" import flash_all_messages%} +{%from "populations/macro-select-population.html" import select_population_form%} +{%from "populations/macro-display-population-card.html" import display_population_card%} + +{%block title%}Samples — List Samples{%endblock%} + +{%block pagetitle%}Samples — List Samples{%endblock%} + +{%block lvl4_breadcrumbs%} + +{%endblock%} + +{%block contents%} +{{flash_all_messages()}} + +
+

+ Samples for population "{{population.FullName}}" from the + "{{species.FullName}}" species. +

+ + {%if samples | length > 0%} +
+
+ {%if offset > 0:%} + + + Previous + + {%endif%} +
+ +
+ Samples {{offset}} — {{offset+(count if offset + count < total_samples else total_samples - offset)}} / {{total_samples}} +
+ +
+ {%if offset + count < total_samples:%} + + Next + + + {%endif%} +
+
+ + + + + + + + + + + + {%for sample in samples%} + + + + + + + {%endfor%} + +
NameAuxilliary NameSymbolAlias
{{sample.Name}}{{sample.Name2}}{{sample.Symbol or "-"}}{{sample.Alias or "-"}}
+ +

+ + delete all samples + +

+ {%else%} +

+ + There are no samples for this population at this time. +

+ +

+ + add samples + +

+ {%endif%} +
+{%endblock%} + +{%block sidebarcontents%} +{{display_population_card(species, population)}} +{%endblock%} + diff --git a/uploader/templates/samples/select-population.html b/uploader/templates/samples/select-population.html index da19ddc..8e22ac1 100644 --- a/uploader/templates/samples/select-population.html +++ b/uploader/templates/samples/select-population.html @@ -1,99 +1,34 @@ -{%extends "base.html"%} -{%from "flash_messages.html" import flash_messages%} +{%extends "samples/base.html"%} +{%from "flash_messages.html" import flash_all_messages%} +{%from "populations/macro-select-population.html" import select_population_form%} +{%from "species/macro-display-species-card.html" import display_species_card%} -{%block title%}Select Grouping/Population{%endblock%} +{%block title%}Samples — Select Population{%endblock%} -{%block contents%} -

Select grouping/population

- -
-

We organise the samples/cases/strains in a hierarchichal form, starting - with species at the very top. Under species, we have a - grouping in terms of the relevant population - (e.g. Inbred populations, cell tissue, etc.)

-
- -
- select grouping/population - {{flash_messages("error-select-population")}} - - - -
- - -
- - -
- -

OR

- -
- create new grouping/population - {{flash_messages("error-create-population")}} +{%block pagetitle%}Samples — Select Population{%endblock%} - -
- mandatory - - - - - -
-
- Optional - - - - - - - - - -
- - -
+{%block contents%} +{{flash_all_messages()}} +
+

Select the population to use with your samples:

+ {{select_population_form( + url_for("species.populations.samples.select_population", species_id=species.SpeciesId), + populations)}} +
+
+

Cannot find your population in the list?

+ +

If you cannot find the population you want in the drop-down above, you can + instead, + + create a new population. +

{%endblock%} - -{%block javascript%} +{%block sidebarcontents%} +{{display_species_card(species)}} {%endblock%} diff --git a/uploader/templates/samples/select-species.html b/uploader/templates/samples/select-species.html deleted file mode 100644 index aa64ecf..0000000 --- a/uploader/templates/samples/select-species.html +++ /dev/null @@ -1,30 +0,0 @@ -{%extends "base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Select Grouping/Population{%endblock%} - -{%block contents%} -

upload samples/cases

- -

We need to know what species your data belongs to.

- -{{flash_all_messages()}} - -
- upload samples -
- - -
- - -
-{%endblock%} diff --git a/uploader/templates/samples/upload-failure.html b/uploader/templates/samples/upload-failure.html deleted file mode 100644 index 09e2ecf..0000000 --- a/uploader/templates/samples/upload-failure.html +++ /dev/null @@ -1,27 +0,0 @@ -{%extends "base.html"%} -{%from "cli-output.html" import cli_output%} - -{%block title%}Samples Upload Failure{%endblock%} - -{%block contents%} -

{{job.job_name}}

- -

There was a failure attempting to upload the samples.

- -

Here is some information to help with debugging the issue. Provide this - information to the developer/maintainer.

- -

Debugging Information

- - -

stdout

-{{cli_output(job, "stdout")}} - -

stderr

-{{cli_output(job, "stderr")}} - -{%endblock%} diff --git a/uploader/templates/samples/upload-progress.html b/uploader/templates/samples/upload-progress.html deleted file mode 100644 index 7bb02be..0000000 --- a/uploader/templates/samples/upload-progress.html +++ /dev/null @@ -1,22 +0,0 @@ -{%extends "base.html"%} -{%from "cli-output.html" import cli_output%} - -{%block extrameta%} - -{%endblock%} - -{%block title%}Job Status{%endblock%} - -{%block contents%} -

{{job.job_name}}

- -

-status: -{{job["status"]}} ({{job.get("message", "-")}})
-

- -

saving to database...

- -{{cli_output(job, "stdout")}} - -{%endblock%} diff --git a/uploader/templates/samples/upload-samples.html b/uploader/templates/samples/upload-samples.html deleted file mode 100644 index e62de57..0000000 --- a/uploader/templates/samples/upload-samples.html +++ /dev/null @@ -1,139 +0,0 @@ -{%extends "base.html"%} -{%from "flash_messages.html" import flash_messages%} - -{%block title%}Upload Samples{%endblock%} - -{%block css%}{%endblock%} - -{%block contents%} -

upload samples

- -{{flash_messages("alert-success")}} - -

You can now upload a character-separated value (CSV) file that contains - details about your samples. The CSV file should have the following fields: -

-
Name
-
The primary name for the sample
- -
Name2
-
A secondary name for the sample. This can simply be the same as - Name above. This field MUST contain a - value.
- -
Symbol
-
A symbol for the sample. Can be an empty field.
- -
Alias
-
An alias for the sample. Can be an empty field.
-
-

- -
- upload samples - -
- - - {{species.SpeciesName}} [{{species.MenuName}}] -
- -
- - - {{population.Name}} [{{population.FullName}}] -
- -
- - -
- -
- - - - - If you select 'Other' for the field separator value, - enter the character that separates the fields in your CSV file in the form - field below. - -
- -
- - - - Select this if the first line in your file contains headings for the - columns. - -
- -
- - - - If there is a character delimiting the string texts within particular - fields in your CSV, provide the character here. This can be left blank if - no such delimiters exist in your file. - -
- - -
- - - - - - - - - - - - - - - - - - -
preview content
NameName2SymbolAlias
- Please make some selections to preview the data.
- -{%endblock%} - - -{%block javascript%} - -{%endblock%} diff --git a/uploader/templates/samples/upload-success.html b/uploader/templates/samples/upload-success.html deleted file mode 100644 index cb745c3..0000000 --- a/uploader/templates/samples/upload-success.html +++ /dev/null @@ -1,18 +0,0 @@ -{%extends "base.html"%} -{%from "cli-output.html" import cli_output%} - -{%block title%}Job Status{%endblock%} - -{%block contents%} -

{{job.job_name}}

- -

-status: -{{job["status"]}} ({{job.get("message", "-")}})
-

- -

Successfully uploaded the samples.

- -{{cli_output(job, "stdout")}} - -{%endblock%} -- cgit v1.2.3