feat(scripts): add shape-feature backfill script for AromaRegistry
Browse files
scripts/backfill_shape_features.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Backfill 3D shape features into the existing AromaRegistry SQLite database."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import logging
|
| 5 |
+
import sys
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
| 9 |
+
|
| 10 |
+
from pino.registry import AromaRegistry
|
| 11 |
+
|
| 12 |
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
|
| 13 |
+
logger = logging.getLogger("backfill_shape_features")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def main() -> None:
|
| 17 |
+
registry = AromaRegistry()
|
| 18 |
+
registry.backfill_shape_features()
|
| 19 |
+
record = registry.get("5989-27-5") # Limonene
|
| 20 |
+
if record:
|
| 21 |
+
logger.info("Sample shape features for %s: %s", record["cas"], record.get("shape_features"))
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
main()
|