File size: 805 Bytes
64cc758
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import sys
import pandas as pd
import openpyxl
from openpyxl.styles import Font

from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from config.config import (resource_order, resource_unit_map, resource_groups)

wb = openpyxl.Workbook()

resource_to_unit = {
    r: resource_unit_map[group]
    for group, resources in resource_groups.items()
    for r in resources
}

# resource_caps
ws1 = wb.active
ws1.title = "resource_caps"
ws1.append(["Resource", "Unit", "Available Amount"])
ws1["A1"].font = Font(bold=True)
ws1["B1"].font = Font(bold=True)
ws1["C1"].font = Font(bold=True)
for r in resource_order:
    ws1.append([r, resource_to_unit.get(r, ""), float("nan")])

wb.save("data/resource_template.xlsx")
print("Template generated: data/resource_template.xlsx")