# Session selection on MXCuBE
# Use cases
## Within the same beamline
### 1) Within the scheduled time slot
#### a) Single session
When user logs into MXCuBE and there is an available session then it is selected automatically.
```mermaid
gantt
title Use case 1.a
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section Sessions
MX-1234:active, 2024-02-05, 2d
Now : milestone,2024-02-06,
```
The data will be written in the expected folder pre-created with the start date:
```
/data/visitor/MX-1234/ID23-1/20240205
```
#### b) Concurrent sessions
Multiple sessions are allocated simultaneously at the same beamline, same user and same time. MXCuBE will display the list of the sessions, and the user can pick one of them.
**No intervention from Local contact (LC) or instrument responsible (IR) is required.**
```mermaid
gantt
title Use case 1.b
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section ID23-1
MX-1:done, 2024-02-05, 2d
MX-2:done, 2024-02-05, 2d
MX-3:active, 2024-02-05, 2d
MX-4:done, 2024-02-05, 2d
Now : milestone,2024-02-06,
```
The data will be written in the expected folder pre-created with the start date:
```
/data/visitor/MX-1234/ID23-1/20240205
```
### 2) Before the scheduled time slot
In this case, MXCuBE cannot make the session selectable without the intervention of the local contact or beamline responsible.
The procedure is:
1) Local contact (LC) or instrument responsible (IR) logs into MXCuBE
2) A list of sessions will be displayed, including those scheduled for both the future and the past, as well as sessions for other beamlines. Filtering capabilities will also be implemented
3) LC or IR clicks on the button `Select proposal`**, this somehow modifies the session metadata (~start/end date) in ICAT so MXCuBE knows this session has been rescheduled.
4) The user can then log in to ISPyB, as it falls under use case 1.
** Select proposal: this can be renamed by `Allow access` or `move session to current time slot` or `whatever`
```mermaid
gantt
title Use case 2
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section ID23-1
MX-1234:a1, 2024-02-09, 3d
Now : milestone,2024-02-08,
```
The data will be written in the expected folder pre-created with the start date:
```
/data/visitor/MX-1234/ID23-1/20240209
```
### 3) After the scheduled time slot
Sampe procedure as use case 2)
```mermaid
gantt
title Use case 3
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section ID23-1
MX-1234:a1, 2024-02-09, 3d
Now : milestone,2024-02-013,
```
The data will be written in the expected folder pre-created with the start date:
```
/data/visitor/MX-1234/ID23-1/20240209
```
### 4) Multiple sessions
Multiple sessions can be allocated within the allowed time window (90 days?) for the same or different proposals. A user might want to select session (1) to finish their experiment if some samples were left.
Take into account, specially on BAGs, group of people and samples from proposal 1), 2) and 3) might be different
LC or IR interventation is needed as it falls into use case 2) and 3)
```mermaid
gantt
title Use case 4
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section ID23-1
MX-1234 (1):active, 2024-02-09, 1d
MX-1234 (2):done, 2024-02-11, 1d
MX-1234 (3):done, 2024-02-15, 1d
Now : milestone,2024-02-13,
```
The data will be written in the expected folder pre-created with the start date:
```
/data/visitor/MX-1234/ID23-1/20240209
```
## Different beamlines
It might happen that before or during the experiment, samples from a session need to be moved to another beamline to continue the experiment.
In this case, the LC or IR can create a new session from MXCuBE as it is happening currently with ISPyB. Once the session is created then the user can log into MXCube.
Procedure:
1) LC or IR logs into the target beamline (ID23-2)
2) The session originally scheduled on ID23-1 appears in the list
3) LC or IR selects the proposal. This will make that a new session is created in ICAT, the users and samples will be copied from original session to the new session.
4) User can log into MXCuBE@ID23-2 and select the new proposal.
5) Somehow, we need to make sure that the synchronization of the samples is done with the original proposal. Sample changer issues?
```mermaid
gantt
title Use case 4
dateFormat YYYY-MM-DD
todayMarker off
tickInterval 1day
section ID23-1
MX-1234:crit, 2024-02-09, 1d
section ID23-2
MX-1234:active, 2024-02-10, 2d
```
The data will be written in the ~~expected~~ folder pre-created with the start date if data has been collected and for the new beamline:
```
/data/visitor/MX-1234/ID23-1/20240209
/data/visitor/MX-1234/ID23-2/20240209
```
# Quick summary
## Same beamline
| Use case | Requires LC intervention | Requires new session |
| -------- | -------- | -------- |
| Single session | No | No |
| Concurrent sessions | No | No |
| Before session | Yes | No |
| After session | Yes | No |
| Multiple sessions | Yes | No |
## Different beamlines
| Use case | Requires manual intervention | Requires session creation |
| -------- | -------- | -------- |
| Single session | Yes | Yes |