|
8 | 8 | "\n", |
9 | 9 | "[![Open In Colab][colab_badge]][colab_link]\n", |
10 | 10 | "\n", |
11 | | - "This notebook is a demo of the Vuegen Python library. This sofwtare automates the creation of reports based on a directory with plots, dataframes, and other files in different formats. A YAML configuration file is generated from the directory to define the structure of the report. Users can customize the report by modifying the configuration file, or they can create their own configuration file instead of passing a directory as input. \n", |
| 11 | + "This notebook is an end-to-end demo of the Vuegen Python package, starting from content generation. This sofwtare automates the creation of reports based on a directory with plots, dataframes, and other files in different formats. A YAML configuration file is generated from the directory to define the structure of the report. Users can customize the report by modifying the configuration file, or they can create their own configuration file instead of passing a directory as input. \n", |
12 | 12 | "\n", |
13 | 13 | "The configuration file specifies the structure of the report, including sections, subsections, and various components such as plots, dataframes, markdown, html, and API calls. Reports can be generated in various formats, including documents (PDF, HTML, DOCX, ODT), presentations (PPTX, Reveal.js), notebooks (Jupyter) or Streamlit web applications.\n", |
14 | 14 | "\n", |
|
59 | 59 | "cell_type": "markdown", |
60 | 60 | "metadata": {}, |
61 | 61 | "source": [ |
62 | | - "### 0.1. Global variables for platform and working directory\n", |
| 62 | + "### 0.1. Installing libraries and creating global variables for platform and working directory\n", |
63 | 63 | "\n", |
64 | 64 | "To run this notebook locally, you should create a virtual environment with the required libraries and set the `platform` variable to `local_notebook`. If you are running this notebook on Google Colab, set the `platform` variable to `colab`." |
65 | 65 | ] |
|
70 | 70 | "metadata": {}, |
71 | 71 | "outputs": [], |
72 | 72 | "source": [ |
73 | | - "platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}" |
| 73 | + "# Vuegen library \n", |
| 74 | + "%pip install vuegen" |
74 | 75 | ] |
75 | 76 | }, |
76 | 77 | { |
|
79 | 80 | "metadata": {}, |
80 | 81 | "outputs": [], |
81 | 82 | "source": [ |
82 | | - "# Output directory\n", |
83 | | - "base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\"" |
84 | | - ] |
85 | | - }, |
86 | | - { |
87 | | - "cell_type": "markdown", |
88 | | - "metadata": {}, |
89 | | - "source": [ |
90 | | - "### 0.2. Installing libraries" |
| 83 | + "# Libraries for the notebook\n", |
| 84 | + "%pip install cartopy seaborn biom-format" |
91 | 85 | ] |
92 | 86 | }, |
93 | 87 | { |
|
96 | 90 | "metadata": {}, |
97 | 91 | "outputs": [], |
98 | 92 | "source": [ |
99 | | - "# Vuegen library \n", |
100 | | - "%pip install vuegen" |
| 93 | + "platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}" |
101 | 94 | ] |
102 | 95 | }, |
103 | 96 | { |
|
106 | 99 | "metadata": {}, |
107 | 100 | "outputs": [], |
108 | 101 | "source": [ |
109 | | - "# Libraries for the notebook\n", |
110 | | - "%pip install cartopy seaborn biom-format" |
| 102 | + "# Optional library to launch a streamlit app from colab\n", |
| 103 | + "if platform == 'colab':\n", |
| 104 | + " !npm install localtunnel" |
111 | 105 | ] |
112 | 106 | }, |
113 | 107 | { |
|
116 | 110 | "metadata": {}, |
117 | 111 | "outputs": [], |
118 | 112 | "source": [ |
119 | | - "# Optional library to launch a streamlit app from colab\n", |
120 | | - "if platform == 'colab':\n", |
121 | | - " !npm install localtunnel" |
| 113 | + "# Output directory\n", |
| 114 | + "base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\"" |
122 | 115 | ] |
123 | 116 | }, |
124 | 117 | { |
125 | 118 | "cell_type": "markdown", |
126 | 119 | "metadata": {}, |
127 | 120 | "source": [ |
128 | | - "### 0.3. Importing libraries" |
| 121 | + "### 0.2. Importing libraries" |
129 | 122 | ] |
130 | 123 | }, |
131 | 124 | { |
|
163 | 156 | "cell_type": "markdown", |
164 | 157 | "metadata": {}, |
165 | 158 | "source": [ |
166 | | - "### 0.4. Create working directory" |
| 159 | + "### 0.3. Creating working directory" |
167 | 160 | ] |
168 | 161 | }, |
169 | 162 | { |
|
179 | 172 | "cell_type": "markdown", |
180 | 173 | "metadata": {}, |
181 | 174 | "source": [ |
182 | | - "### 0.5. Markdown project description\n", |
| 175 | + "### 0.4. Markdown project description\n", |
183 | 176 | "Create a markdown file with the project description to be displayed in the main page of the report. It is also possible to do this for the sections and subsections of the report by creating a `description.md` file in the corresponding directory." |
184 | 177 | ] |
185 | 178 | }, |
|
208 | 201 | "cell_type": "markdown", |
209 | 202 | "metadata": {}, |
210 | 203 | "source": [ |
211 | | - "### 0.6. Helper functions" |
| 204 | + "### 0.5. Helper functions" |
212 | 205 | ] |
213 | 206 | }, |
214 | 207 | { |
|
1384 | 1377 | "metadata": {}, |
1385 | 1378 | "outputs": [], |
1386 | 1379 | "source": [ |
1387 | | - "report_type = \"streamlit\"\n", |
1388 | | - "report_name = \"Earth_microbiome_vuegen_demo_notebook_dir\"\n", |
1389 | | - "\n", |
1390 | | - "# Initialize logger\n", |
1391 | | - "logger = get_logger(f\"{report_type}_report_{report_name}\")\n", |
1392 | | - "\n", |
1393 | 1380 | "# Generate the report\n", |
1394 | | - "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = logger)" |
| 1381 | + "report_type = \"streamlit\"\n", |
| 1382 | + "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example\"))" |
1395 | 1383 | ] |
1396 | 1384 | }, |
1397 | 1385 | { |
|
1422 | 1410 | "metadata": {}, |
1423 | 1411 | "outputs": [], |
1424 | 1412 | "source": [ |
1425 | | - "report_type = \"html\"\n", |
1426 | | - "report_name = \"Earth_microbiome_vuegen_demo_notebook_dir\"\n", |
1427 | | - "\n", |
1428 | | - "# Initialize logger\n", |
1429 | | - "logger = get_logger(f\"{report_type}_report_{report_name}\")\n", |
1430 | | - "\n", |
1431 | 1413 | "# Generate the report\n", |
1432 | | - "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = logger)" |
| 1414 | + "report_type = \"html\"\n", |
| 1415 | + "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example\"))" |
1433 | 1416 | ] |
1434 | 1417 | }, |
1435 | 1418 | { |
|
1575 | 1558 | "source": [ |
1576 | 1559 | "# Test the changes by generarating the report from the modified YAML file\n", |
1577 | 1560 | "report_type = \"streamlit\"\n", |
1578 | | - "report_name = \"Earth_microbiome_vuegen_demo_notebook_config_extended\"\n", |
1579 | | - "\n", |
1580 | | - "# Initialize logger\n", |
1581 | | - "logger = get_logger(f\"{report_type}_report_{report_name}\")\n", |
1582 | | - "\n", |
1583 | | - "# Generate the report\n", |
1584 | | - "report_generator.get_report(config_path = config_path, report_type = report_type, logger = logger)" |
| 1561 | + "report_generator.get_report(config_path = config_path, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example_extended\"))" |
1585 | 1562 | ] |
1586 | 1563 | }, |
1587 | 1564 | { |
|
1614 | 1591 | "source": [ |
1615 | 1592 | "# Test the changes by generarating the report from the modified YAML file\n", |
1616 | 1593 | "report_type = \"html\"\n", |
1617 | | - "report_name = \"Earth_microbiome_vuegen_demo_notebook_config_extended\"\n", |
1618 | | - "\n", |
1619 | | - "# Initialize logger\n", |
1620 | | - "logger = get_logger(f\"{report_type}_report_{report_name}\")\n", |
1621 | | - "\n", |
1622 | | - "# Generate the report\n", |
1623 | | - "report_generator.get_report(config_path = config_path, report_type = report_type, logger = logger)" |
| 1594 | + "report_generator.get_report(config_path = config_path, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example_extended\"))" |
1624 | 1595 | ] |
1625 | 1596 | } |
1626 | 1597 | ], |
|
0 commit comments