Guide adding a new OsmoseField parameter to the schema-driven architecture
Walk through adding a new OSMOSE parameter to the schema-driven architecture.
name (required): the parameter name (e.g., "species.egg.size")type (optional): field type — "float", "int", "bool", "str", "file" (default: "float")Identify the schema module: Find which file in osmose/schema/ the parameter belongs to. Group by process:
species.py — species-level biological parameterspredation.py — predation-related parametersmortality.py — natural/fishing mortalityreproduction.py — reproduction/recruitmentmovement.py — spatial movement mapsgrid.py — spatial grid configurationsimulation.py — simulation control parametersoutput.py — output configurationCheck for existing similar fields: Search for related parameters:
grep -r "{param_prefix}" osmose/schema/
Add the OsmoseField: Add the field definition to the appropriate schema class. Follow existing patterns in the file:
key_pattern: lowercase dot-separated OSMOSE key (e.g., species.egg.size.sp{idx})label: human-readable label for UIdescription: tooltip text explaining the parameterdefault: default value (match Java defaults)min_val/max_val: validation bounds if applicablesp{idx} placeholder in key_patternVerify UI rendering: The UI auto-generates forms from schema metadata. Confirm:
.venv/bin/python -c "from osmose.schema import registry; print([f for f in registry.all_fields() if '{name}' in f.key_pattern])"
Verify config round-trip: Test that the parameter reads from and writes to OSMOSE config format:
.venv/bin/python -m pytest tests/test_schema.py -v -k "round_trip or registry"
Run full test suite to check for regressions:
.venv/bin/python -m pytest tests/ -x -q
.venv/bin/python, never system python/home/razinka/osmose/osmose-python/sp{idx} placeholder, resolved via field.resolve_key(idx)key_pattern.replace(".", "_") — check for collisions with existing fields