# Excel2ResultandEventMaiML

# A: Overview  
This program takes as input:  
- a MaiML file that describes planned information such as procedures and conditions for analytical measurements  
- and an Excel file that records the results executed based on that plan.  

It merges these inputs to generate a MaiML data file of type `maimlRootType`.

---

# B: How to Run  

## Input and Output Data  

### Input Data  
1. **MaiML File**  
   The path to the input MaiML file depends on whether a command-line argument is provided.  
   - **Without argument**: uses `/INPUT/maiml/` + the filename specified in `USERS/usersettings.py`.  
   - **With argument**: uses one MaiML file in the directory specified by the argument.

2. **Excel File**  
   The path to the input Excel file also depends on whether a command-line argument is provided.  
   - **Without argument**: uses `/INPUT/excel/` + the filename specified in `USERS/usersettings.py`.  
   - **With argument**: uses one Excel file in the directory specified by the argument.

3. **External Files**  
   External files inserted into the MaiML file as `<insertion>` elements.  
   - **Without argument**: uses `/INPUT/others/` + the external filename specified in the Excel file.  
   - **With argument**: uses the specified directory + `/` + the filename specified in the Excel file.

### Output Data  
1. **Merged MaiML File**  
   The output MaiML file path depends on whether a command-line argument is provided.  
   - **Without argument**: `OUTPUT/` + the filename specified in `USERS/usersettings.py`.  
   - **With argument**: specified directory + `/` + input MaiML filename + `_output.maiml`.

---

## How to Execute  

### Method 1: Run Without Arguments  
1. **Prepare Input Files**  
   - Edit the input paths in `USERS/usersettings.py` (`_INPUT_MaiML_PATH`, `_IN_EXCEL_FILENAME`).  
   - Place the MaiML file, Excel file, and any external files in the appropriate directories.  

2. **Run the Command**  
   ```sh
   python excel2dataMaiML2.py
    ```

### Method 2: Run with a Directory Argument
1. **Prepare Input Files**
    - Place the MaiML file, Excel file, and any external files in /INPUT/XXXXX/.
        ※ XXXXX can be any directory name.

2. **Run the Command**
    ```sh
    python excel2dataMaiML2.py XXXXX
    ```

---

# C: Python Execution Environment
## Python 3.9 or higher
    - Ensure Python is added to the system PATH.
## Required Python Packages
    - Listed in requirements.txt.

# D: Running Sample Files
## ① Make sure the input files exist in the /INPUT/test/ directory:
    - input.xlsx
    - input.maiml
    - Axoneme-56.008.tif
    - test.txt

## ② Run the Command
    python excel2protocolMaiML2.py test

## ③ Check the output MaiML file in /INPUT/test
    - input_output.maiml
