CarlyneB commited on
Commit
c0da4ca
Β·
1 Parent(s): f666cf8

[DOC] README: fix tab name, add tabs overview, custom resources, scenarios, Case 9, and missing data scripts

Browse files
Files changed (1) hide show
  1. README.md +84 -4
README.md CHANGED
@@ -19,6 +19,9 @@ A Streamlit app for optimizing carbon removal portfolios across different method
19
 
20
  - [Data Maintenance Guide](#data-maintenance-guide)
21
  - [How it works](#how-it-works-overview)
 
 
 
22
  - [Option 1: Hugging Face](#option-1-edit-directly-on-hugging-face-no-local-setup-needed)
23
  - [Option 2: Local](#option-2-work-locally)
24
  - [Quick reference](#quick-reference-where-is-each-parameter)
@@ -34,6 +37,7 @@ A Streamlit app for optimizing carbon removal portfolios across different method
34
  - [Case 6 - Change whether a resource is optional](#case-6--change-whether-a-resource-is-optional-secondary-for-a-method)
35
  - [Case 7 - Rename a method or resource](#case-7--rename-a-method-or-resource)
36
  - [Case 8 - Edit tooltip texts](#case-8--edit-tooltip-texts-hover-descriptions)
 
37
  - [Case 10 - Change the display order](#case-10--change-the-display-order-of-methods-or-resources)
38
  - [After any change - checklist](#after-any-change--checklist)
39
  - [Library Maintenance Guide](#library-maintenance-guide)
@@ -66,7 +70,47 @@ data/inputs_aggregated.csv
66
 
67
  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.
68
 
69
- **Automatic method deactivation:** if a CDR method requires resources that the user has not added in Tab 1 (Resource inputs), the method is automatically disabled in Tabs 2 (Method constraints) and 4 (Optimization). A "Why is this method disabled?" indicator is shown next to the method. This is expected behavior β€” no data change is needed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  There are two ways to update the data, depending on whether you are working directly on Hugging Face or on a local copy of the project:
72
 
@@ -205,12 +249,14 @@ Hugging Face will detect the push and rebuild the Space automatically.
205
  | File | What it is | Do you edit it? |
206
  |------|-----------|-----------------|
207
  | `data/inputs_aggregated.csv` | **Main data file**: all methods, resources and coefficients | βœ… Yes |
208
- | `data/update.py` | Script that regenerates everything from the CSV | ❌ No |
 
 
 
209
  | `data/cost_sliders.json` | Auto-generated. Coefficients used by the app | ❌ No (auto) |
210
  | `data/method_groups.json` | Auto-generated. CDR method categories | ❌ No (auto) |
211
- | `data/secondary_resources.json` | Auto-generated. optional resource assignments | ❌ No (auto) |
212
  | `data/resource_template.xlsx` | Auto-generated. Excel template for users | ❌ No (auto) |
213
- | `data/tooltips.xlsx` | Tooltip texts shown on hover in the app | βœ… Yes |
214
 
215
  > ⚠️ **Never edit the auto-generated files directly**: your changes will be overwritten the next time `update.py` is run.
216
 
@@ -483,6 +529,40 @@ The `.xlsx` file cannot be edited inline on Hugging Face. Instead:
483
 
484
  ---
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  ### Case 10 - Change the display order of methods or resources
487
 
488
  **When to use:** You want a method or resource group to appear earlier or later in the app (Resource inputs, Method constraints tabs...).
 
19
 
20
  - [Data Maintenance Guide](#data-maintenance-guide)
21
  - [How it works](#how-it-works-overview)
22
+ - [App tabs](#app-tabs)
23
+ - [Custom resources](#custom-resources)
24
+ - [Scenarios (save and compare)](#scenarios-save-and-compare)
25
  - [Option 1: Hugging Face](#option-1-edit-directly-on-hugging-face-no-local-setup-needed)
26
  - [Option 2: Local](#option-2-work-locally)
27
  - [Quick reference](#quick-reference-where-is-each-parameter)
 
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)
43
  - [Library Maintenance Guide](#library-maintenance-guide)
 
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.
72
 
73
+ **Automatic method deactivation:** if a CDR method requires resources that the user has not added in the Resource inputs tab, the method is automatically disabled in the Method constraints and Portfolio generation tabs. A "Why is this method disabled?" indicator is shown next to the method. This is expected behavior β€” no data change is needed.
74
+
75
+ ---
76
+
77
+ ### App tabs
78
+
79
+ The app has seven tabs, accessible from the left sidebar:
80
+
81
+ | Tab | Name | Purpose |
82
+ |-----|------|---------|
83
+ | Welcome | Welcome | Introduction, instructions, and a quick-start guide |
84
+ | Resource inputs | Resource inputs | Set the available quantity of each resource; add custom resource batches |
85
+ | Method constraints | Method constraints | Activate or deactivate CDR methods; set caps and constraints per method |
86
+ | Resource coefficients | Resource coefficients | View and adjust the coefficient values (min / median / max) used by the optimizer |
87
+ | Portfolio generation | Portfolio generation | Run the LP optimizer and view results (charts, tables, resource usage) |
88
+ | Sensitivity analysis | Sensitivity analysis | Analyse how binding each resource constraint is; identify bottlenecks |
89
+ | Scenario comparison | Scenario comparison | Save the current scenario, load a previous one, and compare multiple runs side by side |
90
+
91
+ ---
92
+
93
+ ### Custom resources
94
+
95
+ In the **Resource inputs** tab, users can add custom resource batches β€” named resources that substitute for a standard or "Other" reference resource within a specific CDR method.
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 optimizer 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
+
103
+ ### Scenarios (save and compare)
104
+
105
+ In the **Scenario comparison** tab, users can:
106
+
107
+ - **Export** the current state (resource caps, method constraints, coefficients, optimization results) as a `.zip` file or an Excel `.xlsx` file
108
+ - **Import** a previously exported scenario file to restore a complete session state
109
+ - **Compare** multiple saved scenarios side by side in the charts
110
+
111
+ Scenario files are standalone and portable. Exporting a ZIP preserves the full state including custom resource batches; the Excel format covers the core results and can be opened directly in Excel.
112
+
113
+ ---
114
 
115
  There are two ways to update the data, depending on whether you are working directly on Hugging Face or on a local copy of the project:
116
 
 
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 |
256
  | `data/cost_sliders.json` | Auto-generated. Coefficients used by the app | ❌ No (auto) |
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
 
 
529
 
530
  ---
531
 
532
+ ### Case 9 - Remove a method or resource
533
+
534
+ **When to use:** A CDR method or resource is no longer relevant and should be removed from the tool entirely.
535
+
536
+ > ⚠️ If users have saved scenario files (`.xlsx` or `.zip`) that reference the removed method or resource, those fields will be silently ignored on load β€” no error is raised, but the data will be missing from the restored session.
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
556
+ ```
557
+ 4. Commit and push:
558
+ ```
559
+ git add -A -- ':!venv/'
560
+ git commit -m "Remove [method name / resource name]"
561
+ git push
562
+ ```
563
+
564
+ ---
565
+
566
  ### Case 10 - Change the display order of methods or resources
567
 
568
  **When to use:** You want a method or resource group to appear earlier or later in the app (Resource inputs, Method constraints tabs...).