Genesis Classic Key Converter
Genesis ID Conversion
A Python utility that converts Genesis Classic GUIDs to their corresponding Genesis Classic integer IDs (Legacy Keys), enabling accurate matching of items between Genesis Classic and Genesis Foods.
Background
Genesis Foods identifies food entities using GUIDs derived deterministically from Genesis Classic integer IDs (Legacy Keys). This utility converts a Genesis Classic GUID back to its original Legacy Key, enabling the item to be matched to the corresponding entity in Genesis Foods.
Requirements
Python 3.9+
No third-party dependencies (uses only
hashlib,struct, anduuidfrom the standard library)
Command Line Usage
Extract: Genesis Classic GUID → Legacy ID
bash
python genesis_id_conversion.py extract <guid>Example:
bash
python genesis_id_conversion.py extract 550e8400-e29b-41d4-a716-446655440000
# Legacy Classic ID: 12345Derive : Legacy ID → Genesis Classic GUID
bash
python genesis_id_conversion.py derive [ingredient|recipe|composite] <legacy_id>Examples:
bash
python genesis_id_conversion.py derive ingredient 12345
# Genesis Classic GUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
python genesis_id_conversion.py derive recipe 12345
# Genesis Classic GUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
python genesis_id_conversion.py derive composite 12345
# Genesis Classic GUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxUsage as a Module
python
from genesis_id_conversion import extract_legacy_id, derive_guid, FoodType
# GUID → Legacy ID
keys = extract_legacy_id("550e8400-e29b-41d4-a716-446655440000")
print(keys[0]) # e.g. 12345
# Legacy ID → GUID
guid = derive_guid(FoodType.INGREDIENT, 12345)
guid = derive_guid(FoodType.RECIPE, 12345)
guid = derive_guid(FoodType.COMPOSITE_INGREDIENT, 12345)Appendix
API
extract_legacy_id(guid_str, key_part_count=1)
Extracts legacy Classic ID(s) from a Genesis Foods GUID.
Parameter | Type | Default | Description |
|---|---|---|---|
|
| required | Genesis Foods GUID string (standard hyphenated format) |
|
|
| Number of legacy key parts to extract (1–3) |
Returns: list[int] — signed 32-bit legacy ID(s).
Raises:
ValueError— ifkey_part_countis not between 1 and 3ValueError— ifguid_stris not a valid GUID string
derive_guid(food_type, legacy_id)
Derives a Genesis Classic GUID from a food type and legacy Classic integer ID.
Parameter | Type | Description |
|---|---|---|
|
| The food entity type ( |
|
| Legacy Genesis Classic integer ID |
Returns: str — Genesis Foods GUID string.
FoodType (Enum)
Member | URN |
|---|---|
|
|
|
|
|
|
Notes
Round-trip Consistency
The two operations are fully reversible for the same food type:
python
derive_guid(FoodType.INGREDIENT, extract_legacy_id(guid)[0]) == guid
extract_legacy_id(derive_guid(FoodType.INGREDIENT, legacy_id))[0] == legacy_idz
Connecting Legacy ID within Genesis Foods
Once you have the LegacyKey you can do a Search on Foods and the FoodSearchInput should include the LegacyKey as the searchText and LegacyKey as the SearchFieldFilter.
Download