Skip to content

Conversation

@uw-amy-bordenave
Copy link
Collaborator

Initial commit with added support for multiple quest answer dependencies.

Summary, generated by Claude 4.0:


Comparing schema-2.0.0.json with schema-3.0.0.json, here are the key changes:

Main Changes:

1. Schema Version Updated

  • Version bumped from "2.0.0" to "3.0.0"

2. Complete Overhaul of quest_answer_dependency

In schema-2.0.0.json:

  • Simple object structure
  • Only supports single dependency (one question/answer pair)
  • No description text
  • No required properties defined
"quest_answer_dependency": {
  "description": "",
  "type": "object",
  "properties": {
    "question_id": { ... },
    "required_value": { ... }
  }
}

In schema-3.0.0.json:

  • More powerful oneOf structure
  • Supports both single AND multiple dependencies
  • Comprehensive description explaining AND logic
  • Required properties defined for both formats
  • Added examples showing both usage patterns
"quest_answer_dependency": {
  "description": "Dependency conditions that must be met for this question to be visible. Can be a single condition object or an array of condition objects. When multiple conditions are provided, ALL conditions must be satisfied (AND logic).",
  "oneOf": [
    {
      "type": "object",
      "properties": { ... },
      "required": ["question_id", "required_value"]
    },
    {
      "type": "array",
      "items": { ... },
      "minItems": 1
    }
  ],
  "examples": [ ... ]
}

Summary:

The primary change is that schema-3.0.0.json enables multiple dependency conditions while schema-2.0.0.json only allowed a single dependency. This is a significant functional enhancement that allows questions to depend on multiple other questions simultaneously, with all conditions needing to be satisfied (AND logic).


@uw-amy-bordenave
Copy link
Collaborator Author

Scope: Update Long Form Quest Definition JSON Schema to 3.0.0 version with support for new quest_types: MultipleChoice and TextEntry, and multiple quest_answer_dependency


MultipleChoice is similar to ExclusiveChoice, but allows multiple options to be selected and enters them as a semicolon-delimited string. (ExclusiveChoice is radio buttons, MultipleChoice is checkboxes)


TextEntry is similar to Numeric, but allows for input of arbitrary text entry.


Multiple quest_answer_dependency enables things like "Answer additional questions?" + "(tactile_paving=yes)" → "What is the color of this tactile paving?"

…ype. Added new quest types Multiplechoice, Textentry. Added new definition 'dependency'. Updated schema to not allow additional Properties(helps in validation)
@iamrajeshk iamrajeshk mentioned this pull request Sep 16, 2025
@uw-amy-bordenave
Copy link
Collaborator Author

Apologies, I meant to switch branches - you can ignore f764013 and 6dda653 as they are unrelated to the topic of this PR and do not impact any of the relevant files.

@uw-amy-bordenave
Copy link
Collaborator Author

uw-amy-bordenave commented Sep 18, 2025

Flagging an issue: quest_answer_choices is incorrectly required for quest_type=Numeric

What is currently:

"allOf": [
  {
    "if": {
      "properties": { "quest_type": { "const": "TextEntry" } }
    },
    "else": {
      "required": ["quest_answer_choices"]
    }
  }
]

Should be:

"allOf": [
  {
    "if": {
      "properties": { 
        "quest_type": { 
          "enum": ["ExclusiveChoice", "MultipleChoice"] 
        } 
      }
    },
    "then": {
      "required": ["quest_answer_choices"]
    }
  }
]

This change flips the logic, so that quest_answer_choices is /only/ required for ExclusiveChoice and MultipleChoice, rather than exempting only TextEntry

@uw-amy-bordenave
Copy link
Collaborator Author

I'd also like us to add to this an improved quest_id numbering system, originally brought up by @shockwave656

Starting at 1XX, each element_type increments the first digit by +1.
Starting at X01, each child quest's quest_id increments the rest by +1.

Example:

element_type=Sidewalks
--- quest_id=101
--- quest_id=102
--- quest_id=103
element_type=Crossings
--- quest_id=201
--- ...
--- quest_id=209
--- quest_id=210
--- quest_id=211
element_type=Curbs
--- quest_id=301
--- quest_id=302

@cyrossignol cyrossignol force-pushed the quest-definition-schema-3.0.0 branch from 6dda653 to ddccf79 Compare September 22, 2025 05:31
@cyrossignol
Copy link

Apologies, I meant to switch branches - you can ignore f764013 and 6dda653 as they are unrelated to the topic of this PR and do not impact any of the relevant files.

@uw-amy-bordenave No worries. I popped those two commits off of this branch.

Copy link

@cyrossignol cyrossignol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues stand out to me aside from the reversed logic that @uw-amy-bordenave already brought up!

"if": {
"properties": { "quest_type": { "const": "TextEntry" } }
},
"else": {
Copy link

@cyrossignol cyrossignol Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugging in @uw-amy-bordenave's comment.

"1",
"2"
]
"required_value": ["1", "2"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you get more into GitHub, here's a friendly PR etiquette tip: I'd avoid mixing cosmetic and content changes in the same PR. The noisy diffs may divert attention from the "meat" of the PR. Good PRs usually have a narrow focus/scope.

In this case, I'm also a little worried that someone may inadvertently reverse the changes with some automated formatting tool—some editors run these automatically these days.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up and the best-practices tip :)
In this case, that's exactly what happened - ran the Prettier formatter in VS Code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to check in that Prettier config to this repo so tools don't fight with each other over formatting.

@uw-amy-bordenave
Copy link
Collaborator Author

Apologies, I meant to switch branches - you can ignore f764013 and 6dda653 as they are unrelated to the topic of this PR and do not impact any of the relevant files.

@uw-amy-bordenave No worries. I popped those two commits off of this branch.

Thanks. Completed these in #29.

Flips the implementation logic so that `quest_answer_choices` is only required for `ExclusiveChoice` and `MultipleChoice`, rather than exempting only `TextEntry`
@uw-amy-bordenave
Copy link
Collaborator Author

  1. Synced with main in 2f7a95e
  2. Implemented fix for quest_answer_choices logic in 2a83840 as mentioned above:

Flagging an issue: quest_answer_choices is incorrectly required for quest_type=Numeric

What is currently:

"allOf": [
  {
    "if": {
      "properties": { "quest_type": { "const": "TextEntry" } }
    },
    "else": {
      "required": ["quest_answer_choices"]
    }
  }
]

Should be:

"allOf": [
  {
    "if": {
      "properties": { 
        "quest_type": { 
          "enum": ["ExclusiveChoice", "MultipleChoice"] 
        } 
      }
    },
    "then": {
      "required": ["quest_answer_choices"]
    }
  }
]

This change flips the logic, so that quest_answer_choices is /only/ required for ExclusiveChoice and MultipleChoice, rather than exempting only TextEntry

@uw-amy-bordenave uw-amy-bordenave marked this pull request as ready for review September 23, 2025 20:06
Hint at suggested numbering approach (101, 102, 201, 202, 301, 302, ...)
@uw-amy-bordenave
Copy link
Collaborator Author

uw-amy-bordenave commented Sep 23, 2025

Disregard #25 (comment), we are holding off on redefining the quest_id approach until 4.0.0:

Short-term, as these continue to be created manually, the examples hint at the recommended numbering approach. (101, 102, ..., 201, 202, ..., 301, 302, ...)

Long-term, we'll want to use descriptive quest_ids that either mirror the StreetComplete approach (AddSidewalkSurface, AddCrossingMarkings, etc.) or mirror existing naming style for other fields (add_sidewalk_surface, or sidewalk_surface, or sidewalk:surface, or ...?) - either way, a change of quest_ids from number to string would need corresponding changes made to AVIV ScoutRoute (example: changing var questID: Int) which we can discuss at a later date.


Reviewed on call by @uw-amy-bordenave and @cyrossignol on 2025-09-23

@iamrajeshk Ready for final review from you.

Copy link
Contributor

@iamrajeshk iamrajeshk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @uw-amy-bordenave Please merge it.

@uw-amy-bordenave uw-amy-bordenave merged commit c8001c3 into main Sep 24, 2025
2 checks passed
@uw-amy-bordenave uw-amy-bordenave deleted the quest-definition-schema-3.0.0 branch September 24, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants