Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗃️ Add "not applicable" where applicable in schema #34

Open
shnizzedy opened this issue Feb 3, 2024 · 0 comments
Open

🗃️ Add "not applicable" where applicable in schema #34

shnizzedy opened this issue Feb 3, 2024 · 0 comments

Comments

@shnizzedy
Copy link
Member

shnizzedy commented Feb 3, 2024

"4": {
"type": "boolean",
"title": "Thorough description of required and optional input parameters",
"default": false
},

For some items, like this one, where the answer could be "not applicable", I think we'll need

"anyOf": [
  { "type": "boolean" },
  { "type": "string", "enum": ["not applicable"] }
]

#30 (comment)

Makes sense! Not applicable could also be a boolean

#30 (comment)

/**
* Returns a string representation of the fraction of true values in an object.
*
* @param obj Object to count
* @returns String representation of the fraction of true values
*/
export function dictFractionTrueString(obj: { [key: string]: boolean }): string {
const total = Object.values(obj).length;
const trueCount = Object.values(obj).filter(v => v === true).length;
return `${trueCount}/${total}`;
}

Once handling 'n/a's is addressed, we'll need to discount those items from the total.

#30 (comment)

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

No branches or pull requests

1 participant