pages/static/anatomy-quiz.html

562 lines
18 KiB
HTML
Raw Normal View History

2022-08-29 22:01:33 +00:00
<!DOCTYPE html>
<body>
2022-09-24 23:17:09 +00:00
<h1>MillironX's Anatomy Quiz Generator</h1>
<h2>Quiz material weighting</h2>
<div id="weights"></div>
2022-09-24 23:55:26 +00:00
<hr />
<div>
<label for="num-questions">Number of questions </label>
<input id="num-questions" type="number" value="15" />
</div>
<hr />
<button onClick="generate_quiz">Generate!</button>
<hr />
<h2>Quiz</h2>
2022-08-29 22:01:33 +00:00
<ul id="quiz-terms"></ul>
<script>
2022-09-22 22:55:01 +00:00
const BoldTerms = {
bones: {
scapula: { // id: scapula
asymmetric: true, // id: glenoid cavity of scapula
features: { // articulation: glenoid cavity of scapula (head of humerus)
"glenoid cavity": { // id: spine of scapula
articulation: "head of humerus", // id: acromion of scapula
}, // attachment: acromion of scapula (deltoideus)
spine: {}, //
acromion: { //
attachment: "deltoideus", //
}, //
}, //
}, //
humerus: {
asymmetric: true,
features: {
head: {
articulation: "glenoid cavity",
},
"intertubercular groove": {},
"greater tubercle": {},
},
},
radius: {
asymmetric: true,
features: {
head: {},
"fovea capitis": {
articulation: "capitulum of humerus",
},
"articular circumference": {
articulation: "radial notch of ulna",
},
},
},
},
muscles: {
"superficial pectoral": {
features: {
"descending pectoral": {
origin: "cranial sternebrae",
insertion: "greater tubercle of humerus",
action: "adduct forelimb",
},
"transverse pectoral": {
origin: "cranial sternebrae",
insertion: "greater tubercle of humerus",
action: "adduct forelimb",
},
},
},
"deep pectoral": {
origin: "ventral sternum",
insertion: "fleshy",
action: "flex and extend shoulder joint",
},
brachiocephalicus: {
features: {
cleidobrachialis: {
origin: "clavicle",
insertion: "cranial border of humerus",
action: "extend shoulder joint",
},
cleidocephalicus: {
origin: "clavicle",
insertion: "occipital bone",
action: "extend shoulder joint",
},
},
},
},
joints: {
humeral: {},
cubiti: {},
metacarpophalangeal: {},
},
other: {
"superficial cervical lymph node": {},
"carotid sheath": {},
},
};
2022-09-24 23:02:35 +00:00
function structure_question(structure, props) {
let quiz_list = [];
quiz_list.push(`id: ${structure}`);
if ("features" in props) {
for (feature in props["features"]) {
let questions = feature_question(
`${feature} of ${structure}`,
props["features"][feature]
);
for (const question of questions) {
quiz_list.push(question);
}
}
}
return quiz_list;
}
function feature_question(feature, props) {
let quiz_list = [];
quiz_list.push(`id: ${feature}`);
for (const prop in props) {
if (prop != "asymmetric") {
quiz_list.push(property_question(feature, prop, props[prop]));
}
}
return quiz_list;
}
function property_question(feature, prop_name, prop_content) {
return `${prop_name}: ${feature} (${prop_content})`;
}
2022-09-24 23:17:09 +00:00
const weights_spinner_div = document.getElementById("weights");
for (structure_type in BoldTerms) {
const form_div = document.createElement("div");
const weight_spinner = document.createElement("input");
weight_spinner.setAttribute("id", `${structure_type}-weight`);
weight_spinner.setAttribute("type", "number");
weight_spinner.setAttribute("value", "10");
const weight_spinner_label = document.createElement("label");
weight_spinner_label.setAttribute("for", `${structure_type}-weight`);
weight_spinner_label.textContent = `${structure_type} `;
form_div.appendChild(weight_spinner_label);
form_div.appendChild(weight_spinner);
weights_spinner_div.append(form_div);
}
2022-09-24 23:55:26 +00:00
// Shamelessly stolen from
// https://github.com/trekhleb/javascript-algorithms/blob/master/src/algorithms/statistics/weighted-random/weightedRandom.js
function weighted_random(items, weights) {
const cumulativeWeights = [];
for (let i = 0; i < weights.length; i += 1) {
cumulativeWeights[i] = weights[i] + (cumulativeWeights[i - 1] || 0);
}
const maxCumulativeWeight =
cumulativeWeights[cumulativeWeights.length - 1];
const randomNumber = maxCumulativeWeight * Math.random();
for (let itemIndex = 0; itemIndex < items.length; itemIndex += 1) {
if (cumulativeWeights[itemIndex] >= randomNumber) {
return items[itemIndex];
}
}
}
// Shamelessly stolen from
// https://stackoverflow.com/a/15106541
function random_child(object) {
const keys = Object.keys(object);
const i = Math.floor(Math.random() * keys.length);
return {
key: keys[i],
object: object[keys[i]],
};
}
const terms_list = document.getElementById("quiz-terms");
function generate_quiz() {
let weights = [];
let types = [];
for (structure_type in BoldTerms) {
weights.push(
parseInt(document.getElementById(`${structure_type}-weight`).value)
);
types.push(structure_type);
}
const num_questions = document.getElementById("num-questions").value;
for (let i = 0; i <= num_questions; i += 1) {
// Pick the random category
const structure_type = weighted_random(types, weights);
// Pick a random structure from that category
const rand_structure = random_child(BoldTerms[structure_type]);
// Get the list of questions for that structure
const questions = structure_question(
rand_structure.key,
rand_structure.object
);
// Get a random question from that list
const rand_question =
questions[Math.floor(Math.random() * questions.length)];
// Add that structure to the list
let term_item = document.createElement("li");
term_item.innerHTML = rand_question;
terms_list.appendChild(term_item);
}
}
2022-08-29 22:01:33 +00:00
const terms = [
"scapula: glenoid cavity",
"scapula: neck",
"scapula: acromion",
"scapula: supraspinous fossa",
"scapula: infraspinous fossa",
"scapula: serrated face",
"scapula: subscapular fossa",
"scapula: cranial border",
"scapula: scapular notch",
"scapula: cranial angle",
"scapula: dorsal border",
"scapula: caudal angle",
"scapula: caudal border",
"scapula: infraglenoid tubercle",
"scapula: ventral angle",
"scapula: supraglenoid tubercle",
"scapula: coracoid process",
"scapula: suprahamate process",
"humerus: head",
"humerus: intertubercular groove",
"humerus: greater tubercle",
"humerus: lesser tubercle",
"humerus: neck",
"humerus: cranial surface",
"humerus: crest of the greater tubercle",
"humerus: lateral surface",
"humerus: deltoid tuberosity",
"humerus: tricipital line",
"humerus: tuberosity of the teres minor",
"humerus: brachialis groove",
"humerus: lateral supracondylar crest",
"humerus: caudal surface",
"humerus: crest of the lesser tubercle",
"humerus: medial surface",
"humerus: teres major tuberosity",
"humerus: humeral condyle",
"humerus: trochlea",
"humerus: capitulum",
"humerus: lateral epicondyle",
"humerus: medial epicondyle",
"humerus: olecranon fossa",
"humerus: radial fossa",
"humerus: supratrochlear foramen",
"humerus: supracondylar foramen",
"radius: head",
"radius: fovea capitis",
"radius: articular circumference",
"radius: radial tuberosity",
"radius: body",
"radius: trochlea",
"radius: ulnar notch",
"radius: styloid process",
"ulna: trochlear notch",
"ulna: radial notch",
"ulna: olecranon",
"ulna: olecranon tuber",
"ulna: anconeal process",
"ulna: medial coronoid process",
"ulna: lateral coronoid process",
"ulna: body",
"ulna: ulnar tuberosity",
"ulna: interosseous border",
"ulna: styloid process",
"carpal bones: carpus",
"carpal bones: intermedioradial carpal bone",
"carpal bones: ulnar carpal bone",
"carpal bones: accessory carpal bone",
"carpal bones: first carpal bone",
"carpal bones: second carpal bone",
"carpal bones: third carpal bone",
"carpal bones: fourth carpal bone",
"metacarpal bones: metacarpus",
"metacarpal bones: body",
"metacarpal bones: base",
"metacarpal bones: head",
"phalanges: base",
"phalanges: body",
"phalanges: head",
"phalanges: ungual crest",
"phalanges: ungual process",
"phalanges: extensor process",
"phalanges: flexor tubercle",
"phalanges: proximal sesamoid bones",
"phalanges: dorsal sesamoid bones",
"pelvic girdle",
"symphysis pelvis",
"os coxae",
"ilium",
"ischium",
"pubis",
"acetabulum",
"acetabular bone",
"pelvic canal",
"pelvic inlet",
"pelvic outlet",
"ischiatic arc",
"ilium: wing",
"ilium: body",
"ilium: iliac crest",
"ilium: tuber coxae",
"ilium: lateral area for the rectus femoris",
"ilium: tuber sacrale",
"ilium: greater ischiatic notch",
"ilium: gluteal surface",
"ilium: sacropelvic surface",
"ilium: auricular surface",
"ilium: arcuate line",
"ischium: ischiatic tuberosity",
"ischium: body of the ischium",
"ischium: ischiatic spine",
"ischium: lesser ischiatic notch",
"ischium: ramus",
"ischium: ischiatic table",
"ischium: ischiatic arch",
"pubis: body ",
"pubis: cranial ramus ",
"pubis: caudal ramus ",
"pubis: obturator sulcus ",
"pubis: iliopubic eminence ",
"pubis: pubic tubercle ",
"pubis: pectin ",
"pubis: acetabulum ",
"pubis: acetabular notch ",
"pubis: acetabular fossa ",
"pubis: obturator foramen",
"femur: head",
"femur: fovea capitis femoris",
"femur: neck",
"femur: greater trochanter",
"femur: trochanteric fossa",
"femur: lesser trochanter",
"femur: intertrochanteric crest",
"femur: third trochanter",
"femur: body",
"femur: medial lip",
"femur: lateral lip",
"femur: trochlea",
"femur: patella (not part of femur)",
"femur: medial condyle",
"femur: lateral condyle",
"femur: intercondylar fossa",
"femur: medial supracondylar tuberosity",
"femur: lateral supracondylar tuberosity",
"femur: popliteal surface",
"femur: medial epicondyle",
"femur: lateral epicondyle",
"femur: extensor fossa",
"femur: popliteal fossa (not in guide)",
"tibia: medial condyle",
"tibia: lateral condyle",
"tibia: intercondylar eminence",
"tibia: menisci (not part of tibia)",
"tibia: cranial intercondylar area",
"tibia: caudal intercondylar area",
"tibia: popliteal notch",
"tibia: tibial tuberosity",
"tibia: cranial border of tibia",
"tibia: extensor groove",
"tibia: body",
"tibia: tibial cochlea",
"tibia: medial malleolus",
"fibula: body ",
"fibula: head ",
"fibula: lateral malleolus",
"tarsal bones: tarsus",
"tarsal bones: calcaneus",
"tarsal bones: tuber calcanei",
"tarsal bones: sustentaculum tali",
"tarsal bones: talus",
"tarsal bones: trochlea of talus",
"tarsal bones: central tarsal bone",
"tarsal bones: first tarsal bone",
"tarsal bones: second tarsal bone",
"tarsal bones: third tarsal bone",
"tarsal bones: fourth tarsal bone",
"metatarsal bones: base",
"metatarsal bones: body",
"metatarsal bones: head",
"phalanges: pes",
"phalanges: manus",
"phalanges: hallux",
"phalanges: pollex",
"vertebral column",
"cervical vertebrae",
"thoracic vertebrae",
"lumbar vertebrae",
"sacral vertebrae",
"caudal vertebrae",
"sacrum",
"body",
"nucleus pulposus",
"anulus fibrosus",
"vertebral arch",
"pedicles",
"laminae",
"vertebral foramen",
"vertebral canal",
"cranial vertebral notches",
"caudal vertebral notches",
"intervertebral foramina",
"spinous process",
"transverse process",
"articular process",
"cervical vertebrae: atlas: wings of the atlas",
"cervical vertebrae: atlas: body",
"cervical vertebrae: atlas: arch",
"cervical vertebrae: atlas: cranial articular foveae",
"cervical vertebrae: atlas: atlanto-occipital joint",
"cervical vertebrae: atlas: caudal articular foveae",
"cervical vertebrae: atlas: fovea dentis",
"cervical vertebrae: atlas: transverse foramina",
"cervical vertebrae: atlas: lateral vertebral foramina",
"cervical vertebrae: axis: dens",
"cervical vertebrae: axis: cranial articular surface",
"cervical vertebrae: ventral lamina",
"cervical vertebrae: cranial articular processes",
"cervical vertebrae: caudal articular processes",
"cervical vertebrae: ventral crest",
"cervical vertebrae: spinous process",
"cervical vertebrae: transverse process",
"thoracic vertebrae: cranial costal fovea",
"thoracic vertebrae: caudal costal fovea",
"thoracic vertebrae: spine (spinous process)",
"thoracic vertebrae: anticlinal vertebra",
"thoracic vertebrae: cranial articular processes",
"thoracic vertebrae: caudal articular processes",
"thoracic vertebrae: transverse process",
"thoracic vertebrae: accessory process",
"thoracic vertebrae: mamillary process",
"lumbar vertebrae: transverse processes",
"lumbar vertebrae: cranial articular processes",
"lumbar vertebrae: caudal articular processes",
"lumbar vertebrae: spinous process",
"lumbar vertebrae: accessory process",
"lumbar vertebrae: mamillary process",
"sacrum: body",
"sacrum: median sacral crest",
"sacrum: dorsal sacral foramina",
"sacrum: pelvic sacral foramina",
"sacrum: auricular face",
"sacrum: base",
"sacrum: sacral promontory",
"ribs: costal cartilages",
"ribs: costal arch",
"ribs: head",
"ribs: tubercle",
"ribs: neck",
"sternum: sternebrae",
"sternum: intersternebral cartilages",
"sternum: manubrium",
"sternum: xiphoid process",
"skull: incisive bone",
"skull: nasal bone",
"skull: maxilla",
"skull: lacrimal bone",
"skull: palatine bone",
"skull: zygomatic bone",
"skull: frontal bone",
"skull: temporal bone",
"skull: mastoid process",
"skull: parietal bone",
"skull: occipital bone",
"skull: occipital condyle",
"skull: foramen magnum",
"skull: external occipital protuberance",
"skull: nuchal crest",
"skull: pterygoid bone",
"skull: sphenoid complex",
"skull: basisphenoid bone",
"skull: presphenoid bone",
"skull: vomer bone",
"skull: mandible",
"hyoid apparatus: stylohyoid bone",
"hyoid apparatus: epihyoid bone",
"hyoid apparatus: ceratohyoid bone",
"hyoid apparatus: basihyoid bone",
"hyoid apparatus: thyrohyoid bone",
"larynx: epiglottis",
"larynx: thyroid cartilage",
2022-09-18 14:26:52 +00:00
"larynx: cricoid cartilage",
"Superficial Pectoral",
"Deep (Ascending) Pectoral",
"Brachiocephalicus",
"Omotransversarius",
"Trapezius",
"Rhomboideus",
"Latissimus Dorsi",
"Serratus Ventralis",
"Sternocephalicus",
"Sternohyoideus",
"Sternothyroideus",
"Deltoideus",
"Supraspinatus",
"Infraspinatus",
"Teres minor",
"Subscapularis",
"Teres Major",
"Coracobrachialis",
"Biceps brachii",
"Brachialis",
"Triceps brachii",
"Tensor fasciae antebrachia",
"Anconeus",
"Extensor Carpi Radialis",
"Common Digital Extensor",
"Lateral Digital Extensor",
"Ulnaris Lateralis",
"Supinator ",
"Adductor Pollicis Longus",
"Brachioradialis",
"Flexor Carpi Radialis",
"Flexor Carpi Ulnaris",
"Superficial Digital Flexor",
"Deep Digital Flexor",
"Pronator Teres",
"Pronator Quadratus m.",
"Tensor fasciae latae ",
"Superficial gluteal ",
"Middle gluteal ",
"Piriformis",
"Deep gluteal",
"Articularis coxae ",
"External obturator ",
"Internal obturator ",
"Gemelli ",
"Quadratus femoris ",
"Biceps femoris",
"Semitendinosus",
"Semimembranosus",
"Sartorius ",
"Gracilis ",
"Pectineus",
"Adductor",
"Quadriceps femoris ",
"Iliopsoas"
2022-08-29 22:01:33 +00:00
];
2022-09-24 23:55:26 +00:00
generate_quiz();
2022-08-29 22:01:33 +00:00
</script>
</body>