2.2 KiB
2.2 KiB
Core Rules & App Mechanics
When generating the Python logic for the JSON, you must adhere to these rules because of how the app's Kotlin data models and Room database are structured:
- Export Structure: The root object is a
CategoryExport. It must contain exactly one category definition and an array of items belonging to it. - Dummy IDs: Do not attempt to guess or fetch the target database IDs. The app handles ID remapping (ConflictResolution) natively during import.
- Always use
99999for the categoryid. - Start item
ids sequentially from100000.
- Always use
- Hardcoded Dates: The Kotlin parser uses
kotlinx.serializationand strictly expects ISO-8601 timestamps for date fields. If they are missing or empty, the app will crash. However, the dates do not need to be accurate for new imports. Hardcode"2024-01-01T00:00:00.000Z"for theexportDateandcreatedAtfields. - Minimal Data:
formatVersionmust be1.- The
statesarray must be completely empty:[](since these are new words without learning history). - The
featuresproperty on every item must strictly be an empty JSON object string:"{}". - Completely omit the
zipfFrequencyFirstandzipfFrequencySecondfields.
- Stage Mappings: Every generated item needs a corresponding entry in the
stageMappingsarray, setting its learning stage to"NEW".
Target JSON Schema
Your Python script must output a JSON file that perfectly matches this structure. The items and stageMappings arrays should expand dynamically based on the input words.
{
"type": "Category",
"formatVersion": 1,
"exportDate": "2024-01-01T00:00:00.000Z",
"metadata": {
"itemCount": 1,
"categoryCount": 1,
"exportScope": "Category: <CATEGORY_NAME>"
},
"category": {
"type": "TagCategory",
"id": 99999,
"name": "<CATEGORY_NAME>"
},
"items": [
{
"id": 100000,
"languageFirstId": <LANG_FIRST_ID>,
"languageSecondId": <LANG_SECOND_ID>,
"wordFirst": "<WORD_1>",
"wordSecond": "<WORD_2>",
"createdAt": "2024-01-01T00:00:00.000Z",
"features": "{}"
}
],
"states": [],
"stageMappings": [
{
"vocabularyItemId": 100000,
"stage": "NEW"
}
]
}