Convert openLCA JSON-LD to TIDAS/eILCD JSON for TianGong LCA database
Project description
olca2tidas
将 openLCA 导出的 JSON-LD 一键转换为 TIDAS / eILCD 风格 JSON(便于导入天工数据库)、并输出认证清单。 本工具在您的原始转换脚本基础上,封装为 pip 可安装、带 CLI、支持日志输出。
1) 安装
pip install olca2tidas
或者从源码安装:
git clone https://github.com/Kirin-Ciao/olca2tidas.git
cd olca2tidas
pip install -e .
2) 快速开始
方式 A:使用包装后的命令 olca2tidas(推荐)
# Windows 示例(注意路径需要引号)
olca2tidas -- --src "E:\openLCA\tiangong\<your-file>" --out "E:\openLCA\tiangong\Result"
# 同时把控制台输出保存到日志文件:
olca2tidas --log-file logs/run-$(date +%Y%m%d-%H%M%S).log -- --src "C:\data\JSON-LD" --out "C:\data\Result"
--之后的参数将原样转发给您的转换脚本(位于olca2tidas.converter)。 > 需要查看底层脚本的帮助时,运行:olca2tidas -- --help
方式 B:直接调用底层脚本(开发/调试)
python -m olca2tidas.converter --src "/path/to/JSON-LD" --out "/path/to/Result"
3) 常见参数
--log-file <path>:将控制台输出同时写入该日志文件(wrapper 提供)。--log-level {DEBUG,INFO,WARNING,ERROR}:调整 wrapper 日志等级(默认INFO)。-- --help:查看底层转换脚本自己的--help说明(由脚本的argparse提供)。
底层脚本支持参数(示例):
--src、--out、--version、--edge_dir、--locale、--no-cert等。
4) 输出
转换完成后,会在输出目录生成:
data/flows/*.json,data/processes/*.json,data/lifecyclemodels/*.json(覆盖保存后的 ILCD/TIDAS JSON)convert_manifest.json:包含转换数量、SHA256 校验与结构验证结果
5) 开发&发布
-
运行测试:
pytest -q -
本地构建:
python -m pip install --upgrade build python -m build
-
发布到 PyPI:
python -m pip install --upgrade build twine python -m build python -m twine upload dist/*
-
GitHub Actions 自动发布:打 tag(如
v0.1.0)后自动构建并上传(需在仓库 Secrets 中设置PYPI_API_TOKEN)。
6) 许可
MIT License © Qilin Cao
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file olca2tidas-0.1.6.tar.gz.
File metadata
- Download URL: olca2tidas-0.1.6.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466f201d3e940f8dbc709134951fa94e9646c7f89604ecacb228bdde0110f175
|
|
| MD5 |
dd3e53f65bac1a4537ab4a4bb12945b4
|
|
| BLAKE2b-256 |
c3473915c466f88e5d29332aaf48ac1f5d21cb175cee24df511fb4ba258fe244
|
File details
Details for the file olca2tidas-0.1.6-py3-none-any.whl.
File metadata
- Download URL: olca2tidas-0.1.6-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7d719f6f679c4617d9817e5974e4f6fac5b78433152f61dc3e0bea15ab9f962
|
|
| MD5 |
3c56e6ab375d29feb90043cf43e028c7
|
|
| BLAKE2b-256 |
f7adaf2ff89e12a84108ababc58622d6788de54fb0a0a4dc085302c53d9c2e57
|