diff --git a/bindings/sirius/src/sirius.rs b/bindings/sirius/src/sirius.rs index b72761f1..13ec82eb 100644 --- a/bindings/sirius/src/sirius.rs +++ b/bindings/sirius/src/sirius.rs @@ -94,13 +94,21 @@ impl Sirius { // We check that the provided sirius username and password are not empty if sirius_username.is_empty() { +<<<<<<< HEAD + return Err(format!(concat!( +======= return Err(concat!( +>>>>>>> 846f0feac57a70f394fa531de8010a2013d16a77 "The sirius username provided in the environment variable SIRIUS_USERNAME is empty. ", "We expected there to exist a .env file in the current directory ", "with the SIRIUS_USERNAME variable set to the username of the sirius account. ", "The variable may also be set in the environment directly, for instance ", "in the .bashrc file." +<<<<<<< HEAD + ))); +======= ).to_string()); +>>>>>>> 846f0feac57a70f394fa531de8010a2013d16a77 } if sirius_password.is_empty() { @@ -153,6 +161,22 @@ impl Sirius { )); } + // We check that the extension of the input file is MGF, in either upper or lower case + let input_file_extension = input_file_path + .extension() + .ok_or_else(|| format!(concat!( + "The input file {:?} does not have an extension. ", + "We expected the input file to have the extension .mgf" + ), input_file_path))?; + + if input_file_extension.to_string_lossy().to_lowercase() != "mgf" { + return Err(format!( + "The input file {:?} does not have the extension .mgf", + input_file_path + )); + } + + // Prepare the command let mut command = Command::new(sirius_path); diff --git a/web/backend/migrations/2024-02-06-144906_create_items_table/up.sql b/web/backend/migrations/2024-02-06-144906_create_items_table/up.sql index 8bed5e6d..06923d5b 100644 --- a/web/backend/migrations/2024-02-06-144906_create_items_table/up.sql +++ b/web/backend/migrations/2024-02-06-144906_create_items_table/up.sql @@ -6,4 +6,22 @@ -- items. This table defines the items that are tracked and managed by the system. -- An item can be movable or immovable. -- An example of an Item may be a measurement device, a tube potentially containing a sample, --- or a sample itself. \ No newline at end of file +-- or a sample itself. +CREATE TABLE items ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name TEXT NOT NULL, + description TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + created_by UUID NOT NULL, + updated_by UUID NOT NULL, + project_id UUID NOT NULL, + parent_id UUID, + location_id UUID, + FOREIGN KEY (created_by) REFERENCES users(id), + FOREIGN KEY (updated_by) REFERENCES users(id), + FOREIGN KEY (project_id) REFERENCES projects(id), + FOREIGN KEY (parent_id) REFERENCES items(id), + FOREIGN KEY (item_type_id) REFERENCES item_types(id), + FOREIGN KEY (location_id) REFERENCES locations(id) +); \ No newline at end of file diff --git a/web/backend/migrations/2024-02-09-102550_create_procedure_item_requirements_table/down.sql b/web/backend/migrations/2024-02-09-102550_create_procedure_item_discrete_requirements_table/down.sql similarity index 100% rename from web/backend/migrations/2024-02-09-102550_create_procedure_item_requirements_table/down.sql rename to web/backend/migrations/2024-02-09-102550_create_procedure_item_discrete_requirements_table/down.sql diff --git a/web/backend/migrations/2024-02-09-102550_create_procedure_item_requirements_table/up.sql b/web/backend/migrations/2024-02-09-102550_create_procedure_item_discrete_requirements_table/up.sql similarity index 99% rename from web/backend/migrations/2024-02-09-102550_create_procedure_item_requirements_table/up.sql rename to web/backend/migrations/2024-02-09-102550_create_procedure_item_discrete_requirements_table/up.sql index dac55ce3..93aeb6bf 100644 --- a/web/backend/migrations/2024-02-09-102550_create_procedure_item_requirements_table/up.sql +++ b/web/backend/migrations/2024-02-09-102550_create_procedure_item_discrete_requirements_table/up.sql @@ -12,4 +12,4 @@ CREATE TABLE procedure_item_requirements ( updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (procedure_id, item_category_id), FOREIGN KEY (item_category_id, unit_id) REFERENCES item_units(item_id, unit_id) -); \ No newline at end of file +); \ No newline at end of file diff --git a/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/down.sql b/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/down.sql new file mode 100644 index 00000000..d9a93fe9 --- /dev/null +++ b/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/down.sql @@ -0,0 +1 @@ +-- This file should undo anything in `up.sql` diff --git a/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/up.sql b/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/up.sql new file mode 100644 index 00000000..2003cf7d --- /dev/null +++ b/web/backend/migrations/2024-02-09-143242_create_item_real_quantities_table/up.sql @@ -0,0 +1,19 @@ +-- SQL defining the item_real_quantities table. +-- Each item, being a physical object, has a weight. This table defines the weights of items. +-- The weight of an item may change over time, and be measured using different scales and by +-- different people. +CREATE TABLE item_real_quantities ( + id SERIAL PRIMARY KEY, + item_id INTEGER REFERENCES items(id), + weight DECIMAL(10, 2) NOT NULL, + unit_id INTEGER REFERENCES units(id), + sensor_id INTEGER REFERENCES items(id), + measured_at TIMESTAMPTZ NOT NULL DEFAULT now(), + measured_by INTEGER REFERENCES users(id), + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + created_by INTEGER NOT NULL REFERENCES users(id), + updated_by INTEGER NOT NULL REFERENCES users(id), + FOREIGN KEY (item_id, unit_id) REFERENCES items(item_id, unit_id), + FOREIGN KEY (unit_id) REFERENCES real_units(id) +); \ No newline at end of file diff --git a/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/down.sql b/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/down.sql new file mode 100644 index 00000000..d9a93fe9 --- /dev/null +++ b/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/down.sql @@ -0,0 +1 @@ +-- This file should undo anything in `up.sql` diff --git a/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/up.sql b/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/up.sql new file mode 100644 index 00000000..afa2572d --- /dev/null +++ b/web/backend/migrations/2024-02-09-144314_create_item_discrete_quantities_table/up.sql @@ -0,0 +1,22 @@ +-- SQL defining the item_quantities table. +-- Some items may be counted discretely, as opposed to a weight in grams. +-- This table defines the discrete quantities of items that we have in stock. +-- The quantity of an item may change over time, so multiple quantity entries +-- may be inserted for the same item. +-- While these quantities are discrete, in order to facilitate the semantics of +-- the system, we will still allow for the user to specify the counter unit for +-- the item. For example, a counter unit may be a box, a tube, or a vial. +CREATE TABLE item_discrete_quantities ( + id SERIAL PRIMARY KEY, + item_id INTEGER REFERENCES items(id), + quantity INTEGER NOT NULL, + unit_id INTEGER REFERENCES weight_units(id), + measured_at TIMESTAMPTZ NOT NULL DEFAULT now(), + measured_by INTEGER REFERENCES users(id), + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + created_by INTEGER NOT NULL REFERENCES users(id), + updated_by INTEGER NOT NULL REFERENCES users(id), + FOREIGN KEY (item_id, unit_id) REFERENCES item_units(item_id, unit_id), + FOREIGN KEY (unit_id) REFERENCES discrete_units(id) +); \ No newline at end of file diff --git a/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/down.sql b/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/down.sql new file mode 100644 index 00000000..d9a93fe9 --- /dev/null +++ b/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/down.sql @@ -0,0 +1 @@ +-- This file should undo anything in `up.sql` diff --git a/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/up.sql b/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/up.sql new file mode 100644 index 00000000..8e8ef004 --- /dev/null +++ b/web/backend/migrations/2024-02-09-155933_create_discrete_units_table/up.sql @@ -0,0 +1,7 @@ +-- SQL describing the discrete_units table. +-- The discrete_units table is used as the finite set of units that can be used to measure +-- the discrete quantities of items. For example, a box, a tube, or a vial. +CREATE TABLE discrete_units ( + id INTEGER PRIMARY KEY, + FOREIGN KEY (id) REFERENCES units(id) +); \ No newline at end of file diff --git a/web/backend/migrations/2024-02-09-160358_create_real_units_table/down.sql b/web/backend/migrations/2024-02-09-160358_create_real_units_table/down.sql new file mode 100644 index 00000000..d9a93fe9 --- /dev/null +++ b/web/backend/migrations/2024-02-09-160358_create_real_units_table/down.sql @@ -0,0 +1 @@ +-- This file should undo anything in `up.sql` diff --git a/web/backend/migrations/2024-02-09-160358_create_real_units_table/up.sql b/web/backend/migrations/2024-02-09-160358_create_real_units_table/up.sql new file mode 100644 index 00000000..94a058a9 --- /dev/null +++ b/web/backend/migrations/2024-02-09-160358_create_real_units_table/up.sql @@ -0,0 +1,7 @@ +-- SQL describing the real_units table. +-- The real_units table is used as the finite set of units that can be used to measure +-- the real quantities of items. For example, a box, a tube, or a vial. +CREATE TABLE real_units ( + id INTEGER PRIMARY KEY, + FOREIGN KEY (id) REFERENCES units(id) +); \ No newline at end of file