CarlyneB commited on
Commit
8bd0ff2
Β·
1 Parent(s): f47cede

[DOCS] Update README for non-dev maintenance

Browse files
Files changed (1) hide show
  1. README.md +121 -71
README.md CHANGED
@@ -26,7 +26,7 @@ A Streamlit app for optimising carbon removal portfolios across different method
26
  - [Option 2: Local](#option-2-work-locally)
27
  - [Quick reference](#quick-reference-where-is-each-parameter)
28
  - [File structure](#file-structure-what-each-file-does)
29
- - [Understanding inputs_aggregated.csv](#understanding-inputs_aggregatedcsv)
30
  - [Maintenance cases](#maintenance-cases)
31
  - [Before you start](#before-you-start)
32
  - [Case 1 - Modify existing coefficient values](#case-1--modify-existing-coefficient-values)
@@ -36,7 +36,7 @@ A Streamlit app for optimising carbon removal portfolios across different method
36
  - [Case 5 - Add a new resource group](#case-5--add-a-new-resource-group-new-category)
37
  - [Case 6 - Change whether a resource is optional](#case-6--change-whether-a-resource-is-optional-secondary-for-a-method)
38
  - [Case 7 - Rename a method or resource](#case-7--rename-a-method-or-resource)
39
- - [Case 8 - Edit tooltip texts](#case-8--edit-tooltip-texts-hover-descriptions)
40
  - [Case 9 - Remove a method or resource](#case-9--remove-a-method-or-resource)
41
  - [Case 10 - Change the display order](#case-10--change-the-display-order-of-methods-or-resources)
42
  - [After any change - checklist](#after-any-change--checklist)
@@ -65,7 +65,7 @@ This guide is for Carbon Gap staff who need to update the tool's data: **no codi
65
  All the data the tool uses (CDR methods, resources, coefficients) comes from a single file:
66
 
67
  ```
68
- data/inputs_aggregated.csv
69
  ```
70
 
71
  Every time the app starts, it computes a fingerprint (hash) of the CSV and compares it to the last known value. If they differ, meaning the CSV has been modified, it automatically regenerates all the data files used by the application before loading. You do not need to run anything manually.
@@ -96,7 +96,7 @@ In the **Resource inputs** tab, users can add custom resource batches β€” named
96
 
97
  For example, a user might add a batch called "Basalt A" linked to the reference group "Basalt mineral" and assign it to the Enhanced weathering method. The optimiser will then use the batch's custom coefficients instead of the standard reference values for that method.
98
 
99
- Custom batches are stored in the session and saved when exporting a scenario. They do **not** require any change to `inputs_aggregated.csv`.
100
 
101
  ---
102
 
@@ -121,21 +121,21 @@ This is the simplest option for non-coders with admin access to the Hugging Face
121
  **Steps:**
122
 
123
  1. Go to the Hugging Face **Space** (Carbon Dioxide Removal Toolkit) β†’ click the **Files** tab
124
- 2. Open `data/inputs_aggregated.csv` and click **Edit** (pencil icon)
125
  *OR*
126
- Upload a new version of the file: click **Delete** `data/inputs_aggregated.csv`, then go to **data** folder β†’ click **+ Contribute** β†’ Upload Files
127
- 4. Commit the change directly on Hugging Face (checkbox *Commit directly to the main branch*): the Space will restart automatically
128
- 5. **Check the logs** to confirm the update ran:
129
  - In the Space, click: **Logs** (The button at the very top, next to *Running*)
130
  - You should see:
131
  ```
132
- inputs_aggregated.csv has changed - running data/update.py ...
133
  [... update details ...]
134
  Data files updated successfully.
135
  ```
136
- 6. If the logs show this message, the app is running with the new data. If not, something went wrong: try option 2 or contact a developer. You may also not have waited long enough or, conversely, you may have waited too long before checking the logs: check whether the app has successfully applied your changes.
137
 
138
- > **Note:** with this option, only `inputs_aggregated.csv` needs to be uploaded. The app handles the rest automatically on restart.
139
 
140
  ### Option 2: Work locally
141
 
@@ -143,10 +143,10 @@ Use this option when making bigger changes where you want to preview the result
143
 
144
  **Step 1: Get the project on your machine**
145
 
146
- If you do not already have git installed:
147
- - Mac: install it via https://git-scm.com/download/mac
148
- - Windows: install it via https://git-scm.com/download/win
149
- -
150
  Then in a terminal, navigate to the folder where you want to put the project and run:
151
  ```
152
  git clone <repository URL>
@@ -179,7 +179,7 @@ You only need to do this once per machine. After that, just activate the environ
179
 
180
  **Step 2: Edit the CSV**
181
 
182
- Open `data/inputs_aggregated.csv` in Excel or any spreadsheet editor. Make your changes and save.
183
 
184
  > ⚠️ **Commas in names:** if a method name, resource name, or group name contains a comma, the CSV parser will misread it. Wrap the value in double quotes in the CSV (e.g. `"Biochar, pyrolysis"`) or, preferably, avoid commas entirely and use a dash or slash instead.
185
 
@@ -224,32 +224,34 @@ Hugging Face will detect the push and rebuild the Space automatically.
224
 
225
  | I want to change… | File | Where exactly |
226
  |---|---|---|
227
- | A coefficient value (min / median / max) | `data/inputs_aggregated.csv` | Columns `min`, `median`, `max`: find the row by `Implementation` + `Resource` |
228
- | The name of a CDR method | `data/inputs_aggregated.csv` | Column `Implementation |
229
- | Which group a CDR method belongs to | `data/inputs_aggregated.csv` | Column `Method group` |
230
- | The name of a resource | `data/inputs_aggregated.csv` | Column `Resource` |
231
- | Which group a resource belongs to | `data/inputs_aggregated.csv` | Column `Resource group` |
232
- | The unit of a resource group | `data/inputs_aggregated.csv` | Column `Unit`: must be consistent across all rows for that group |
233
- | Whether a resource is optional for a method | `data/inputs_aggregated.csv` | Column `Is secondary`: `TRUE` = optional, `FALSE` = always active |
234
- | The display order of methods or resources | `data/inputs_aggregated.csv` | Row order: in the app, groups are displayed in the order their first row is encountered in the CSV; within a group, methods or resources are displayed in the order their rows appear. Move rows up/down to reorder |
235
  | The app's UI colours (background, buttons, links) | `.streamlit/config.toml` | `primaryColor`, `backgroundColor`, `secondaryBackgroundColor`, `textColor` |
236
  | The chart colours (Plotly graphs) | `config/config.py` | `CRRA_COLORS` dictionary |
237
  | The app's UI font | `.streamlit/config.toml` | `font` - accepted values: `"sans-serif"`, `"serif"`, `"monospace"` |
238
  | The chart font (Plotly graphs) | `config/config.py` | `CRRA_FONT` variable |
239
  | The app's UI colours and font (fine-tuned overrides) | `assets/styles.css` | `:root` block at the top of the file - change the hex values next to each variable name |
240
- | The tooltip text on a method name | `data/tooltips.xlsx` | Sheet **Methods**: column `Tooltip` |
241
- | The tooltip text on a resource name | `data/tooltips.xlsx` | Sheet **Resources**: column `Tooltip` |
 
 
242
  | UI spacing, font sizes, button styles | `assets/styles.css` | Standard CSS: search for the element name |
243
  | Python library versions | `requirements.txt` | One line per library: see Library Maintenance Guide below |
244
 
245
- > After any change to `inputs_aggregated.csv`, start the app - it detects the change and updates automatically. After changes to `config/config.py`, `assets/styles.css`, or `data/tooltips.xlsx`, simply restart the app.
246
 
247
  ### File structure (what each file does)
248
 
249
  | File | What it is | Do you edit it? |
250
  |------|-----------|-----------------|
251
- | `data/inputs_aggregated.csv` | **Main data file**: all methods, resources and coefficients | βœ… Yes |
252
- | `data/tooltips.xlsx` | Tooltip texts shown on hover in the app | βœ… Yes |
253
  | `data/update.py` | Orchestration script: runs both generators below and updates the hash file | ❌ No |
254
  | `data/generate_model_data.py` | Generates `cost_sliders.json`, `method_groups.json`, `secondary_resources.json` from the CSV | ❌ No |
255
  | `data/generate_resource_template.py` | Generates `resource_template.xlsx` from the CSV | ❌ No |
@@ -257,10 +259,11 @@ Hugging Face will detect the push and rebuild the Space automatically.
257
  | `data/method_groups.json` | Auto-generated. CDR method categories | ❌ No (auto) |
258
  | `data/secondary_resources.json` | Auto-generated. Optional resource assignments | ❌ No (auto) |
259
  | `data/resource_template.xlsx` | Auto-generated. Excel template for users | ❌ No (auto) |
 
260
 
261
  > ⚠️ **Never edit the auto-generated files directly**: your changes will be overwritten the next time `update.py` is run.
262
 
263
- ### Understanding `inputs_aggregated.csv`
264
 
265
  Each row represents **one resource used by one CDR method**, with the following columns:
266
 
@@ -284,6 +287,8 @@ Each row represents **one resource used by one CDR method**, with the following
284
 
285
  > **Naming convention β€” "Other" methods:** any CDR method whose name starts with `Other` receives special treatment in the optimiser. Instead of appearing as a fixed method, the LP automatically creates **one variant per custom resource batch** the user adds that is linked to that method. This is intended for generic CDR pathways where the type of resource is user-defined. If you add a method using this naming convention, make sure it is intentional.
286
 
 
 
287
  ---
288
 
289
  ## Maintenance cases
@@ -314,14 +319,14 @@ You should see `(venv)` at the start of your terminal line.
314
  **Option 1 - On Hugging Face**
315
 
316
  1. In the Space, click the **Files** tab.
317
- 2. Open `data/inputs_aggregated.csv` β†’ click the **pencil icon** to edit inline.
318
  3. Find the row with the correct `Implementation` and `Resource`. Edit the `min`, `median`, and/or `max` columns.
319
  4. Scroll down β†’ **Commit directly to main branch** β†’ **Commit changes to main**.
320
  5. The Space restarts. Click **Logs** to confirm: `Data files updated successfully.`
321
 
322
  **Option 2 - Locally**
323
 
324
- 1. Open `data/inputs_aggregated.csv` in Excel or a text editor.
325
  2. Find the row with the correct `Implementation` and `Resource`.
326
  3. Edit the `min`, `median`, and/or `max` columns.
327
  4. Save the file, then start the app to verify:
@@ -341,13 +346,13 @@ You should see `(venv)` at the start of your terminal line.
341
 
342
  **Option 1 - On Hugging Face**
343
 
344
- 1. In the Space, click **Files** β†’ open `data/inputs_aggregated.csv` β†’ click the pencil icon.
345
- 2. Add a new row, making sure to include all the expected columns (see [Understanding inputs_aggregated.csv](#understanding-inputs_aggregatedcsv)).
346
  3. Commit directly to main β†’ Space restarts. Check Logs for `Data files updated successfully.`
347
 
348
  **Option 2 - Locally**
349
 
350
- 1. Open `data/inputs_aggregated.csv` and add a new row (see [Understanding inputs_aggregated.csv](#understanding-inputs_aggregatedcsv)).
351
  2. Save the file, then start the app to verify:
352
  ```
353
  streamlit run app.py
@@ -367,15 +372,15 @@ You should see `(venv)` at the start of your terminal line.
367
 
368
  **Option 1 - On Hugging Face**
369
 
370
- 1. In the Space, click **Files** β†’ open `data/inputs_aggregated.csv` β†’ click the pencil icon.
371
- 2. Add **one row per resource** the new method uses (see [Understanding inputs_aggregated.csv](#understanding-inputs_aggregatedcsv)). Use an existing `Method group` or create a new one.
372
  3. Place the rows where you want the method to appear: display order follows row order in the CSV.
373
  4. Commit directly to main β†’ Space restarts. Check Logs for `Data files updated successfully.`
374
 
375
  **Option 2 - Locally**
376
 
377
- 1. Open `data/inputs_aggregated.csv`.
378
- 2. Add one row per resource used by the new method. Fill in all columns (see [Understanding inputs_aggregated.csv](#understanding-inputs_aggregatedcsv)).
379
  3. Save the file, then start the app to verify:
380
  ```
381
  streamlit run app.py
@@ -395,10 +400,12 @@ You should see `(venv)` at the start of your terminal line.
395
 
396
  > ⚠️ **"Other" resource naming:** if you name the resource starting with `Other ` (capital O + space β€” e.g. `Other land`, `Other water`), it will be **hidden from the standard resource display** in the app. Users won't see it as a standalone input row, but it will still be available as a reference group when they use the "Add resource" dialog. Only use this prefix if you specifically want the resource to be hidden from direct input.
397
 
 
 
398
  **Option 1 - On Hugging Face**
399
 
400
  1. Decide which **Resource group** the new resource belongs to. If it belongs to an existing group, use the exact same name. If it needs its own group, see Case 5.
401
- 2. In the Space, click **Files** β†’ open `data/inputs_aggregated.csv` β†’ pencil icon.
402
  3. Add one row per method that uses this resource (see column descriptions in Case 2).
403
  4. **Check the unit:** all resources in a group must share the same unit (e.g., all `Land` resources use `Mha/MtCO2`). If the unit differs, create a new group (Case 5).
404
  5. Commit directly to main β†’ Space restarts. Check Logs.
@@ -406,7 +413,7 @@ You should see `(venv)` at the start of your terminal line.
406
  **Option 2 - Locally**
407
 
408
  1. Decide which Resource group the new resource belongs to.
409
- 2. Open `data/inputs_aggregated.csv` and add one row per method that uses this resource.
410
  3. Verify the unit is consistent with the rest of the group.
411
  4. Save, then start the app to verify:
412
  ```
@@ -423,7 +430,7 @@ You should see `(venv)` at the start of your terminal line.
423
 
424
  ### Case 5 - Add a new resource group (new category)
425
 
426
- **When to use:** Your new resource doesn't fit any existing category.
427
 
428
  **Option 1 - On Hugging Face**
429
 
@@ -439,16 +446,18 @@ Same steps as Case 4, but write a **new group name** in the `Resource group` col
439
 
440
  **When to use:** You want to make a resource optional (user can enable/disable it) or make it always required.
441
 
 
 
442
  **Option 1 - On Hugging Face**
443
 
444
- 1. In the Space, click **Files** β†’ open `data/inputs_aggregated.csv` β†’ pencil icon.
445
  2. Find the row with the correct `Implementation` and `Resource`.
446
  3. Change `Is secondary` to `TRUE` (optional) or `FALSE` (always active).
447
  4. Commit directly to main β†’ Space restarts. Check Logs.
448
 
449
  **Option 2 - Locally**
450
 
451
- 1. Open `data/inputs_aggregated.csv`.
452
  2. Find the row with the correct `Implementation` and `Resource`.
453
  3. Change `Is secondary` to `TRUE` (optional) or `FALSE` (always active).
454
  4. Save, then start the app to verify:
@@ -473,16 +482,16 @@ Same steps as Case 4, but write a **new group name** in the `Resource group` col
473
  **Option 1 - On Hugging Face**
474
 
475
  Editing inline is not recommended for a rename because Find & Replace is not available in the browser editor. Instead:
476
- 1. Download `data/inputs_aggregated.csv` from the Files tab.
477
  2. Open it in Excel. Use **Find & Replace** (Ctrl+H / Cmd+H) to replace the old name with the new name in the `Implementation` / `Resource` columns and, if the group name changed, in `Method group` / `Resource group`.
478
- 3. Also download `data/tooltips.xlsx`, update the name in the `Method` or `Resource` column of the relevant sheet, and save.
479
  4. Upload both files via **Files** β†’ `data/` folder β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit.
480
  5. Space restarts β†’ check Logs.
481
 
482
  **Option 2 - Locally**
483
 
484
- 1. Open `data/inputs_aggregated.csv`. Use **Find & Replace** (Ctrl+H / Cmd+H) to replace the old name everywhere in the file.
485
- 2. Open `data/tooltips.xlsx` and update the name in the `Method` or `Resource` column of the relevant sheet. Save.
486
  3. Start the app to verify:
487
  ```
488
  streamlit run app.py
@@ -496,34 +505,60 @@ Editing inline is not recommended for a rename because Find & Replace is not ava
496
 
497
  ---
498
 
499
- ### Case 8 - Edit tooltip texts (hover descriptions)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
- **When to use:** You want to add, update, or remove the short description that appears when a user hovers over a resource or method name in the app.
502
 
503
- > ⚠️ The name in column `Resource` or `Method` must match **exactly** the name used in `inputs_aggregated.csv` (same spelling, same capitalisation). If you rename a method or resource in the CSV, remember to update the name in `tooltips.xlsx` too.
504
 
505
  **Option 1 - On Hugging Face**
506
 
507
  The `.xlsx` file cannot be edited inline on Hugging Face. Instead:
508
- 1. In the Files tab, open the `data/` folder β†’ download `tooltips.xlsx`.
509
- 2. Open it in Excel. Go to the relevant sheet (**Resources** or **Methods**).
510
- 3. Find the row with the name you want to edit. Fill in or change the `Tooltip` column. Leave it empty to remove a tooltip.
511
  4. Save the file.
512
  5. Back in the Files tab, go to `data/` β†’ **+ Contribute** β†’ **Upload Files**.
513
- 6. Upload your edited `tooltips.xlsx` β†’ Commit directly to main.
514
- 7. The Space restarts. **No update script runs for tooltips** - the file is read directly by the app on each restart.
515
 
516
  **Option 2 - Locally**
517
 
518
- 1. Open `data/tooltips.xlsx` in Excel.
519
- 2. Go to the relevant sheet (**Resources** or **Methods**).
520
- 3. Find the row with the name you want to edit. Fill in or change the `Tooltip` column. Leave it empty to remove a tooltip.
521
  4. Save the file.
522
  5. Restart the app (`Ctrl+C` then `streamlit run app.py`). **No need to run `update.py`.**
523
  6. Commit and push:
524
  ```
525
- git add data/tooltips.xlsx
526
- git commit -m "Update tooltip texts"
527
  git push
528
  ```
529
 
@@ -537,19 +572,19 @@ The `.xlsx` file cannot be edited inline on Hugging Face. Instead:
537
 
538
  **Option 1 - On Hugging Face**
539
 
540
- 1. Download `data/inputs_aggregated.csv` from the Files tab.
541
  2. Open it in Excel. Delete all rows where the `Implementation` column matches the method to remove, **or** all rows where the `Resource` column matches the resource to remove.
542
  - To remove a method: delete every row for that `Implementation` value.
543
  - To remove a resource from one method only: delete only the row(s) matching both the `Implementation` and `Resource`.
544
  - To remove a resource entirely: delete every row where the `Resource` column matches, across all methods.
545
- 3. Also open `data/tooltips.xlsx` and delete the corresponding row in the **Methods** or **Resources** sheet if a tooltip exists for the removed item.
546
  4. Upload both modified files via **Files** β†’ `data/` β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit directly to main.
547
  5. Space restarts β†’ check Logs for `Data files updated successfully.`
548
 
549
  **Option 2 - Locally**
550
 
551
- 1. Open `data/inputs_aggregated.csv` and delete the relevant rows (see Option 1 above for which rows to target).
552
- 2. Open `data/tooltips.xlsx` and delete the corresponding tooltip row if one exists. Save.
553
  3. Start the app to verify:
554
  ```
555
  streamlit run app.py
@@ -570,14 +605,14 @@ The `.xlsx` file cannot be edited inline on Hugging Face. Instead:
570
  **Option 1 - On Hugging Face**
571
 
572
  Moving rows is easier in Excel than in a browser editor:
573
- 1. Download `data/inputs_aggregated.csv` from the Files tab.
574
  2. Open it in Excel. Move the relevant rows up or down - the app reads the CSV from top to bottom.
575
  3. Upload the updated file via **Files** β†’ `data/` β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit.
576
  4. Space restarts β†’ check Logs for `Data files updated successfully.`
577
 
578
  **Option 2 - Locally**
579
 
580
- 1. Open `data/inputs_aggregated.csv`.
581
  2. Move the relevant rows up or down.
582
  3. Save, then start the app to verify:
583
  ```
@@ -594,17 +629,32 @@ Moving rows is easier in Excel than in a browser editor:
594
 
595
  ### After any change - checklist
596
 
597
- **Option 1 (Hugging Face direct):**
598
- - [ ] Edited and committed `inputs_aggregated.csv` on Hugging Face
 
 
599
  - [ ] Checked the Space logs: confirmed `Data files updated successfully.`
600
  - [ ] Verified the change appears correctly in the app
601
 
602
- **Option 2 (local):**
603
- - [ ] Saved `inputs_aggregated.csv`
604
  - [ ] Started the app locally (`streamlit run app.py`): confirmed `Data files updated successfully.` in the terminal
605
  - [ ] Verified the change appears correctly in the app
606
  - [ ] Committed all modified files (CSV, JSON files, templates) and pushed
607
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
  ---
609
 
610
  ## Library Maintenance Guide
 
26
  - [Option 2: Local](#option-2-work-locally)
27
  - [Quick reference](#quick-reference-where-is-each-parameter)
28
  - [File structure](#file-structure-what-each-file-does)
29
+ - [Understanding inputs.csv](#understanding-inputscsv)
30
  - [Maintenance cases](#maintenance-cases)
31
  - [Before you start](#before-you-start)
32
  - [Case 1 - Modify existing coefficient values](#case-1--modify-existing-coefficient-values)
 
36
  - [Case 5 - Add a new resource group](#case-5--add-a-new-resource-group-new-category)
37
  - [Case 6 - Change whether a resource is optional](#case-6--change-whether-a-resource-is-optional-secondary-for-a-method)
38
  - [Case 7 - Rename a method or resource](#case-7--rename-a-method-or-resource)
39
+ - [Case 8 - Edit tooltip, method note, and section intro texts](#case-8--edit-tooltip-method-note-and-section-intro-texts)
40
  - [Case 9 - Remove a method or resource](#case-9--remove-a-method-or-resource)
41
  - [Case 10 - Change the display order](#case-10--change-the-display-order-of-methods-or-resources)
42
  - [After any change - checklist](#after-any-change--checklist)
 
65
  All the data the tool uses (CDR methods, resources, coefficients) comes from a single file:
66
 
67
  ```
68
+ data/inputs.csv
69
  ```
70
 
71
  Every time the app starts, it computes a fingerprint (hash) of the CSV and compares it to the last known value. If they differ, meaning the CSV has been modified, it automatically regenerates all the data files used by the application before loading. You do not need to run anything manually.
 
96
 
97
  For example, a user might add a batch called "Basalt A" linked to the reference group "Basalt mineral" and assign it to the Enhanced weathering method. The optimiser will then use the batch's custom coefficients instead of the standard reference values for that method.
98
 
99
+ Custom batches are stored in the session and saved when exporting a scenario. They do **not** require any change to `inputs.csv`.
100
 
101
  ---
102
 
 
121
  **Steps:**
122
 
123
  1. Go to the Hugging Face **Space** (Carbon Dioxide Removal Toolkit) β†’ click the **Files** tab
124
+ 2. Open `data/inputs.csv` and click **Edit** (pencil icon)
125
  *OR*
126
+ Upload a new version of the file: click **Delete** `data/inputs.csv`, then go to **data** folder β†’ click **+ Contribute** β†’ Upload Files
127
+ 3. Commit the change directly on Hugging Face (checkbox *Commit directly to the main branch*): the Space will restart automatically
128
+ 4. **Check the logs** to confirm the update ran:
129
  - In the Space, click: **Logs** (The button at the very top, next to *Running*)
130
  - You should see:
131
  ```
132
+ inputs.csv has changed - running data/update.py ...
133
  [... update details ...]
134
  Data files updated successfully.
135
  ```
136
+ 5. If the logs show this message, the app is running with the new data. If not, something went wrong: try Option 2 or contact a developer. You may also not have waited long enough or, conversely, you may have waited too long before checking the logs: check whether the app has successfully applied your changes.
137
 
138
+ > **Note:** with this option, only `inputs.csv` needs to be uploaded. The app handles the rest automatically on restart.
139
 
140
  ### Option 2: Work locally
141
 
 
143
 
144
  **Step 1: Get the project on your machine**
145
 
146
+ Before starting, make sure you have **Python** (version 3.9 or later) and **git** installed on your machine:
147
+ - Python: https://www.python.org/downloads/ (tick *Add Python to PATH* during installation on Windows)
148
+ - git β€” Mac: https://git-scm.com/download/mac β€” Windows: https://git-scm.com/download/win
149
+
150
  Then in a terminal, navigate to the folder where you want to put the project and run:
151
  ```
152
  git clone <repository URL>
 
179
 
180
  **Step 2: Edit the CSV**
181
 
182
+ Open `data/inputs.csv` in Excel or any spreadsheet editor. Make your changes and save.
183
 
184
  > ⚠️ **Commas in names:** if a method name, resource name, or group name contains a comma, the CSV parser will misread it. Wrap the value in double quotes in the CSV (e.g. `"Biochar, pyrolysis"`) or, preferably, avoid commas entirely and use a dash or slash instead.
185
 
 
224
 
225
  | I want to change… | File | Where exactly |
226
  |---|---|---|
227
+ | A coefficient value (min / median / max) | `data/inputs.csv` | Columns `min`, `median`, `max`: find the row by `Implementation` + `Resource` |
228
+ | The name of a CDR method | `data/inputs.csv` | Column `Implementation` |
229
+ | Which group a CDR method belongs to | `data/inputs.csv` | Column `Method group` |
230
+ | The name of a resource | `data/inputs.csv` | Column `Resource` |
231
+ | Which group a resource belongs to | `data/inputs.csv` | Column `Resource group` |
232
+ | The unit of a resource group | `data/inputs.csv` | Column `Unit`: must be consistent across all rows for that group |
233
+ | Whether a resource is optional for a method | `data/inputs.csv` | Column `Is secondary`: `TRUE` = optional, `FALSE` = always active |
234
+ | The display order of methods or resources | `data/inputs.csv` | Row order: in the app, groups are displayed in the order their first row is encountered in the CSV; within a group, methods or resources are displayed in the order their rows appear. Move rows up/down to reorder |
235
  | The app's UI colours (background, buttons, links) | `.streamlit/config.toml` | `primaryColor`, `backgroundColor`, `secondaryBackgroundColor`, `textColor` |
236
  | The chart colours (Plotly graphs) | `config/config.py` | `CRRA_COLORS` dictionary |
237
  | The app's UI font | `.streamlit/config.toml` | `font` - accepted values: `"sans-serif"`, `"serif"`, `"monospace"` |
238
  | The chart font (Plotly graphs) | `config/config.py` | `CRRA_FONT` variable |
239
  | The app's UI colours and font (fine-tuned overrides) | `assets/styles.css` | `:root` block at the top of the file - change the hex values next to each variable name |
240
+ | The tooltip text on a method name | `data/ui_text.xlsx` | Sheet **Methods**: column `Tooltip` |
241
+ | The tooltip text on a resource name | `data/ui_text.xlsx` | Sheet **Resources**: column `Tooltip` |
242
+ | The text shown in "Why is this method disabled?" for a specific method | `data/ui_text.xlsx` | Sheet **Methods**: column `Note` β€” supports basic HTML (see [Case 8](#case-8--edit-tooltip-method-note-and-section-intro-texts)) |
243
+ | The "OBJECTIVE" intro paragraph at the top of a tab | `data/ui_text.xlsx` | Sheet **Section Intros**: column `Text`, row selected by `Tab` β€” supports basic HTML (see [Case 8](#case-8--edit-tooltip-method-note-and-section-intro-texts)) |
244
  | UI spacing, font sizes, button styles | `assets/styles.css` | Standard CSS: search for the element name |
245
  | Python library versions | `requirements.txt` | One line per library: see Library Maintenance Guide below |
246
 
247
+ > After any change to `inputs.csv`, start the app - it detects the change and updates automatically. After changes to `config/config.py`, `assets/styles.css`, or `data/ui_text.xlsx`, simply restart the app.
248
 
249
  ### File structure (what each file does)
250
 
251
  | File | What it is | Do you edit it? |
252
  |------|-----------|-----------------|
253
+ | `data/inputs.csv` | **Main data file**: all methods, resources and coefficients | βœ… Yes |
254
+ | `data/ui_text.xlsx` | Tooltip texts (on hover), "why is this method disabled?" notes, and each tab's intro paragraph | βœ… Yes |
255
  | `data/update.py` | Orchestration script: runs both generators below and updates the hash file | ❌ No |
256
  | `data/generate_model_data.py` | Generates `cost_sliders.json`, `method_groups.json`, `secondary_resources.json` from the CSV | ❌ No |
257
  | `data/generate_resource_template.py` | Generates `resource_template.xlsx` from the CSV | ❌ No |
 
259
  | `data/method_groups.json` | Auto-generated. CDR method categories | ❌ No (auto) |
260
  | `data/secondary_resources.json` | Auto-generated. Optional resource assignments | ❌ No (auto) |
261
  | `data/resource_template.xlsx` | Auto-generated. Excel template for users | ❌ No (auto) |
262
+ | `data/.csv_hash` | Auto-generated. Stores a fingerprint of `inputs.csv` to detect changes on restart | ❌ No (auto) |
263
 
264
  > ⚠️ **Never edit the auto-generated files directly**: your changes will be overwritten the next time `update.py` is run.
265
 
266
+ ### Understanding `inputs.csv`
267
 
268
  Each row represents **one resource used by one CDR method**, with the following columns:
269
 
 
287
 
288
  > **Naming convention β€” "Other" methods:** any CDR method whose name starts with `Other` receives special treatment in the optimiser. Instead of appearing as a fixed method, the LP automatically creates **one variant per custom resource batch** the user adds that is linked to that method. This is intended for generic CDR pathways where the type of resource is user-defined. If you add a method using this naming convention, make sure it is intentional.
289
 
290
+ > **Resource group and OR-substitutable resources:** when a CDR method has two or more **primary** resources (`Is secondary = FALSE`) that belong to the same `Resource group`, the optimizer treats them as **interchangeable (OR)**. The method can satisfy its resource need from either one, or any mix of the two, rather than requiring all of them simultaneously. Users will see a hint like *"only one of Other land, Arable land is required"* in the "Why is this method disabled?" panel. This behaviour is automatic: it is triggered purely by two active primary resources sharing the same `Resource group` for the same method. **If you add a resource to an existing group for a method that already has a primary resource in that group, you are creating an OR relationship β€” make sure this is intentional.** If it is not, create a new resource group instead (see Case 5).
291
+
292
  ---
293
 
294
  ## Maintenance cases
 
319
  **Option 1 - On Hugging Face**
320
 
321
  1. In the Space, click the **Files** tab.
322
+ 2. Open `data/inputs.csv` β†’ click the **pencil icon** to edit inline.
323
  3. Find the row with the correct `Implementation` and `Resource`. Edit the `min`, `median`, and/or `max` columns.
324
  4. Scroll down β†’ **Commit directly to main branch** β†’ **Commit changes to main**.
325
  5. The Space restarts. Click **Logs** to confirm: `Data files updated successfully.`
326
 
327
  **Option 2 - Locally**
328
 
329
+ 1. Open `data/inputs.csv` in Excel or a text editor.
330
  2. Find the row with the correct `Implementation` and `Resource`.
331
  3. Edit the `min`, `median`, and/or `max` columns.
332
  4. Save the file, then start the app to verify:
 
346
 
347
  **Option 1 - On Hugging Face**
348
 
349
+ 1. In the Space, click **Files** β†’ open `data/inputs.csv` β†’ click the pencil icon.
350
+ 2. Add a new row, making sure to include all the expected columns (see [Understanding inputs.csv](#understanding-inputscsv)).
351
  3. Commit directly to main β†’ Space restarts. Check Logs for `Data files updated successfully.`
352
 
353
  **Option 2 - Locally**
354
 
355
+ 1. Open `data/inputs.csv` and add a new row (see [Understanding inputs.csv](#understanding-inputscsv)).
356
  2. Save the file, then start the app to verify:
357
  ```
358
  streamlit run app.py
 
372
 
373
  **Option 1 - On Hugging Face**
374
 
375
+ 1. In the Space, click **Files** β†’ open `data/inputs.csv` β†’ click the pencil icon.
376
+ 2. Add **one row per resource** the new method uses (see [Understanding inputs.csv](#understanding-inputscsv)). Use an existing `Method group` or create a new one.
377
  3. Place the rows where you want the method to appear: display order follows row order in the CSV.
378
  4. Commit directly to main β†’ Space restarts. Check Logs for `Data files updated successfully.`
379
 
380
  **Option 2 - Locally**
381
 
382
+ 1. Open `data/inputs.csv`.
383
+ 2. Add one row per resource used by the new method. Fill in all columns (see [Understanding inputs.csv](#understanding-inputscsv)).
384
  3. Save the file, then start the app to verify:
385
  ```
386
  streamlit run app.py
 
400
 
401
  > ⚠️ **"Other" resource naming:** if you name the resource starting with `Other ` (capital O + space β€” e.g. `Other land`, `Other water`), it will be **hidden from the standard resource display** in the app. Users won't see it as a standalone input row, but it will still be available as a reference group when they use the "Add resource" dialog. Only use this prefix if you specifically want the resource to be hidden from direct input.
402
 
403
+ > ⚠️ **Adding to an existing Resource group may create an OR relationship:** if the method you are adding this resource to already has a primary resource (`Is secondary = FALSE`) in the same `Resource group`, the optimizer will treat the two resources as interchangeable. See [Understanding inputs.csv](#understanding-inputscsv) for details. If this is not the intended behavior, create a new Resource group instead (Case 5).
404
+
405
  **Option 1 - On Hugging Face**
406
 
407
  1. Decide which **Resource group** the new resource belongs to. If it belongs to an existing group, use the exact same name. If it needs its own group, see Case 5.
408
+ 2. In the Space, click **Files** β†’ open `data/inputs.csv` β†’ pencil icon.
409
  3. Add one row per method that uses this resource (see column descriptions in Case 2).
410
  4. **Check the unit:** all resources in a group must share the same unit (e.g., all `Land` resources use `Mha/MtCO2`). If the unit differs, create a new group (Case 5).
411
  5. Commit directly to main β†’ Space restarts. Check Logs.
 
413
  **Option 2 - Locally**
414
 
415
  1. Decide which Resource group the new resource belongs to.
416
+ 2. Open `data/inputs.csv` and add one row per method that uses this resource.
417
  3. Verify the unit is consistent with the rest of the group.
418
  4. Save, then start the app to verify:
419
  ```
 
430
 
431
  ### Case 5 - Add a new resource group (new category)
432
 
433
+ **When to use:** Your new resource doesn't fit any existing category. Also use this case when the new resource belongs to the same physical category as an existing one but should **not** be treated as interchangeable with it by the optimizer β€” keeping it in a separate group avoids the automatic OR relationship (see [Understanding inputs.csv](#understanding-inputscsv)).
434
 
435
  **Option 1 - On Hugging Face**
436
 
 
446
 
447
  **When to use:** You want to make a resource optional (user can enable/disable it) or make it always required.
448
 
449
+ > ⚠️ **Changing a resource from optional to always active may create an OR relationship:** if you set `Is secondary` to `FALSE` for a resource, and the same method already has another primary resource (`Is secondary = FALSE`) in the same `Resource group`, the optimizer will treat the two as interchangeable. See [Understanding inputs.csv](#understanding-inputscsv) for details. If this is not intended, consider moving the resource to a different group (Case 5).
450
+
451
  **Option 1 - On Hugging Face**
452
 
453
+ 1. In the Space, click **Files** β†’ open `data/inputs.csv` β†’ pencil icon.
454
  2. Find the row with the correct `Implementation` and `Resource`.
455
  3. Change `Is secondary` to `TRUE` (optional) or `FALSE` (always active).
456
  4. Commit directly to main β†’ Space restarts. Check Logs.
457
 
458
  **Option 2 - Locally**
459
 
460
+ 1. Open `data/inputs.csv`.
461
  2. Find the row with the correct `Implementation` and `Resource`.
462
  3. Change `Is secondary` to `TRUE` (optional) or `FALSE` (always active).
463
  4. Save, then start the app to verify:
 
482
  **Option 1 - On Hugging Face**
483
 
484
  Editing inline is not recommended for a rename because Find & Replace is not available in the browser editor. Instead:
485
+ 1. Download `data/inputs.csv` from the Files tab.
486
  2. Open it in Excel. Use **Find & Replace** (Ctrl+H / Cmd+H) to replace the old name with the new name in the `Implementation` / `Resource` columns and, if the group name changed, in `Method group` / `Resource group`.
487
+ 3. Also download `data/ui_text.xlsx`, update the name in the `Method` or `Resource` column of the relevant sheet, and save.
488
  4. Upload both files via **Files** β†’ `data/` folder β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit.
489
  5. Space restarts β†’ check Logs.
490
 
491
  **Option 2 - Locally**
492
 
493
+ 1. Open `data/inputs.csv`. Use **Find & Replace** (Ctrl+H / Cmd+H) to replace the old name everywhere in the file.
494
+ 2. Open `data/ui_text.xlsx` and update the name in the `Method` or `Resource` column of the relevant sheet. Save.
495
  3. Start the app to verify:
496
  ```
497
  streamlit run app.py
 
505
 
506
  ---
507
 
508
+ ### Case 8 - Edit tooltip, method note, and section intro texts
509
+
510
+ **When to use:** You want to add, update, or remove any of the editable text in the app: hover tooltips, the guidance note shown under "Why is this method disabled?" for a specific method, or the "OBJECTIVE" intro paragraph at the top of a tab.
511
+
512
+ Everything is in the same file, `data/ui_text.xlsx`, across three sheets:
513
+
514
+ | Sheet | Columns | Controls |
515
+ |---|---|---|
516
+ | **Resources** | `Resource`, `Tooltip` | Hover tooltip on a resource name |
517
+ | **Methods** | `Method`, `Tooltip`, `Note` | `Tooltip` = hover tooltip on a method name. `Note` = the message shown at the top of that method's "Why is this method disabled?" panel (Method constraints tab) β€” e.g. explaining that Mineral OAE needs a specific mineral feedstock added as a custom resource. Leave empty for no note. |
518
+ | **Section Intros** | `Tab`, `Text` | The "OBJECTIVE" paragraph shown at the top of a tab. One row per tab β€” see the `Tab` key table below. |
519
+
520
+ > ℹ️ **The "Why is this method disabled?" panel shows two types of text that come from different sources.** The resource hints β€” e.g. *"Other land: Add as new resource in Resource inputs"* or *"only one of Other land, Arable land is required"* β€” are **auto-generated** from `inputs.csv` (based on which resources are missing and whether an OR relationship exists). They cannot be changed in `ui_text.xlsx`. The optional free-text `Note` from `ui_text.xlsx` appears above those hints with a lightbulb icon β€” that is the only part you can edit here. To change the resource hints, you need to change the resource or group structure in `inputs.csv`.
521
+
522
+ > ⚠️ **Exact name match:** the name in column `Resource` or `Method` must match **exactly** the name used in `inputs.csv` (same spelling, same capitalisation). If you rename a method or resource in the CSV, remember to update the name in `ui_text.xlsx` too.
523
+
524
+ > ⚠️ **`Tab` keys, not tab titles:** the `Tab` column in **Section Intros** uses the internal page name, not the label shown in the sidebar. Use exactly one of:
525
+ > | `Tab` value | Corresponding tab in the app |
526
+ > |---|---|
527
+ > | `tab1_inputs` | Resource inputs |
528
+ > | `tab2_constraints` | Method constraints |
529
+ > | `tab3_coefficients` | Resource coefficients |
530
+ > | `tab4_optimization` | Portfolio generation |
531
+ > | `tab5_sensitivity` | Sensitivity analysis |
532
+ > A row with any other value is simply ignored.
533
+
534
+ > ⚠️ **These texts contain HTML, not just plain text.** `Tooltip` cells are plain text, but `Note` and `Text` (Section Intros) are rendered as HTML, so you'll see markup like `<strong>bold</strong>`, `<br>` for a line break, and `<li>...</li>` for a bullet-style line. Keep these tags when editing around them β€” deleting a `<` or `>` by accident will make the raw tag appear as text on the page instead of being applied as formatting. You can add more of the same tags (`<strong>`, `<br>`, `<li>`) but avoid pasting anything more advanced (scripts, styles, other tags) since it is not sanitised before display.
535
 
536
+ > ⚠️ **`tab2_constraints`'s text has a placeholder:** its `Text` cell contains `{CO2_UNIT}`, which the app replaces with the actual COβ‚‚ unit (e.g. `MtCOβ‚‚`) when displayed. Keep the `{CO2_UNIT}` placeholder (braces included) if you want that value to appear; removing it just removes the unit from the sentence, it won't break anything.
537
 
538
+ > If a cell is left empty, or a sheet/row is missing entirely, that piece of text is simply skipped (no tooltip / no note / no intro paragraph) β€” nothing crashes.
539
 
540
  **Option 1 - On Hugging Face**
541
 
542
  The `.xlsx` file cannot be edited inline on Hugging Face. Instead:
543
+ 1. In the Files tab, open the `data/` folder β†’ download `ui_text.xlsx`.
544
+ 2. Open it in Excel. Go to the relevant sheet (**Resources**, **Methods**, or **Section Intros**).
545
+ 3. Find the row with the name (or `Tab` key) you want to edit. Fill in or change the `Tooltip` / `Note` / `Text` column. Leave it empty to remove that text.
546
  4. Save the file.
547
  5. Back in the Files tab, go to `data/` β†’ **+ Contribute** β†’ **Upload Files**.
548
+ 6. Upload your edited `ui_text.xlsx` β†’ Commit directly to main.
549
+ 7. The Space restarts. **No update script runs for this file** - it is read directly by the app on each restart.
550
 
551
  **Option 2 - Locally**
552
 
553
+ 1. Open `data/ui_text.xlsx` in Excel.
554
+ 2. Go to the relevant sheet (**Resources**, **Methods**, or **Section Intros**).
555
+ 3. Find the row with the name (or `Tab` key) you want to edit. Fill in or change the `Tooltip` / `Note` / `Text` column. Leave it empty to remove that text.
556
  4. Save the file.
557
  5. Restart the app (`Ctrl+C` then `streamlit run app.py`). **No need to run `update.py`.**
558
  6. Commit and push:
559
  ```
560
+ git add data/ui_text.xlsx
561
+ git commit -m "Update tooltip / method note / section intro texts"
562
  git push
563
  ```
564
 
 
572
 
573
  **Option 1 - On Hugging Face**
574
 
575
+ 1. Download `data/inputs.csv` from the Files tab.
576
  2. Open it in Excel. Delete all rows where the `Implementation` column matches the method to remove, **or** all rows where the `Resource` column matches the resource to remove.
577
  - To remove a method: delete every row for that `Implementation` value.
578
  - To remove a resource from one method only: delete only the row(s) matching both the `Implementation` and `Resource`.
579
  - To remove a resource entirely: delete every row where the `Resource` column matches, across all methods.
580
+ 3. Also open `data/ui_text.xlsx` and delete the corresponding row in the **Methods** or **Resources** sheet if a tooltip exists for the removed item.
581
  4. Upload both modified files via **Files** β†’ `data/` β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit directly to main.
582
  5. Space restarts β†’ check Logs for `Data files updated successfully.`
583
 
584
  **Option 2 - Locally**
585
 
586
+ 1. Open `data/inputs.csv` and delete the relevant rows (see Option 1 above for which rows to target).
587
+ 2. Open `data/ui_text.xlsx` and delete the corresponding tooltip row if one exists. Save.
588
  3. Start the app to verify:
589
  ```
590
  streamlit run app.py
 
605
  **Option 1 - On Hugging Face**
606
 
607
  Moving rows is easier in Excel than in a browser editor:
608
+ 1. Download `data/inputs.csv` from the Files tab.
609
  2. Open it in Excel. Move the relevant rows up or down - the app reads the CSV from top to bottom.
610
  3. Upload the updated file via **Files** β†’ `data/` β†’ **+ Contribute** β†’ **Upload Files** β†’ Commit.
611
  4. Space restarts β†’ check Logs for `Data files updated successfully.`
612
 
613
  **Option 2 - Locally**
614
 
615
+ 1. Open `data/inputs.csv`.
616
  2. Move the relevant rows up or down.
617
  3. Save, then start the app to verify:
618
  ```
 
629
 
630
  ### After any change - checklist
631
 
632
+ **For changes to `inputs.csv` (Cases 1–7, 9–10):**
633
+
634
+ Option 1 (Hugging Face direct):
635
+ - [ ] Edited and committed `inputs.csv` on Hugging Face
636
  - [ ] Checked the Space logs: confirmed `Data files updated successfully.`
637
  - [ ] Verified the change appears correctly in the app
638
 
639
+ Option 2 (local):
640
+ - [ ] Saved `inputs.csv`
641
  - [ ] Started the app locally (`streamlit run app.py`): confirmed `Data files updated successfully.` in the terminal
642
  - [ ] Verified the change appears correctly in the app
643
  - [ ] Committed all modified files (CSV, JSON files, templates) and pushed
644
 
645
+ **For changes to `ui_text.xlsx` (Case 8):**
646
+
647
+ Option 1 (Hugging Face direct):
648
+ - [ ] Downloaded, edited, and re-uploaded `ui_text.xlsx` on Hugging Face
649
+ - [ ] Space has restarted (no update script runs for this file β€” `Data files updated successfully.` will **not** appear in the logs; this is normal)
650
+ - [ ] Verified the updated text appears correctly in the app
651
+
652
+ Option 2 (local):
653
+ - [ ] Saved `data/ui_text.xlsx`
654
+ - [ ] Restarted the app (`Ctrl+C` then `streamlit run app.py`) β€” no need to run `update.py`
655
+ - [ ] Verified the updated text appears correctly in the app
656
+ - [ ] Committed `data/ui_text.xlsx` and pushed
657
+
658
  ---
659
 
660
  ## Library Maintenance Guide