7deadlysinstest / scripts /schema_types.py
drewgrant616's picture
Upload 45 files
81b8593 verified
Raw History Blame Contribute Delete
2.52 kB
"""Explicit JSON Schema definitions for the five JSONL configurations."""
S = {'type': 'string', 'minLength': 1}
B = {'type': 'boolean'}
I = {'type': 'integer', 'minimum': 0}
N = {'type': 'number', 'minimum': 0, 'maximum': 100}
D = {'enum': ['pride', 'envy', 'wrath', 'sloth', 'greed', 'gluttony', 'lust']}
M = {'enum': ['quick', 'full']}
def arr(item, **kwargs):
return {'type': 'array', 'items': item, **kwargs}
def obj(**fields):
return {'type': 'object', 'properties': fields, 'required': list(fields), 'additionalProperties': False}
PROFILE = obj(title=S, leaders=arr(D, uniqueItems=True, maxItems=7))
SCORE = obj(id=D, value=N, count=I)
SCHEMAS = {
'taxonomy': obj(id=D, name=S, latin=S, color={'type':'string','pattern':'^#[0-9a-f]{6}$'},
subtitle=S, description=S, idea=S, position={'type':'integer','minimum':1,'maximum':7},
character_name=S, source_path=S),
'questions': obj(id=S, mode=M, version={'enum':['quick-2','full-1']}, question_id=S,
position={'type':'integer','minimum':1,'maximum':70}, dimension_id=D,
text=S, reverse=B, theme=S, source_item_id=S),
'rules': obj(id=S, position={'type':'integer','minimum':1}, scope=S, condition=S, action=S,
source_path=S, classification_precedence=I),
'scoring_cases': obj(id=S, mode=M, version={'enum':['quick-2','full-1']}, purpose=S, synthetic={'const':True},
answers=arr(obj(question_id=S, raw={'type':['integer','null'],'minimum':0,'maximum':4})),
addressed_count=I, minimum_per_dimension={'enum':[2,8]},
scores=arr(SCORE,minItems=7,maxItems=7), computed_profile=PROFILE,
computed_character=obj(id={'enum':['pride','envy','wrath','sloth','greed','gluttony','lust','quiet','mixed','balanced']},name=S,title=S),
coverage_complete=B, possible_completed_ranges=arr(obj(id=D,low=N,high=N),minItems=7,maxItems=7),
sensitivity=obj(checked=I,changed=I), result_eligible=B),
'classification_cases': obj(id=S,synthetic={'const':True},input_space={'const':'arbitrary_score_vectors_not_questionnaire_attempts'},
scores=arr(SCORE,minItems=7,maxItems=7),expected_profile=PROFILE),
}
DOCUMENT = {'$schema':'https://json-schema.org/draft/2020-12/schema',
'title':'Seven Sides JSONL record schemas; select #/$defs/<config>',
'$defs':SCHEMAS}