How eric7829/cognitivefunctiontest works
Project Type & Purpose
• This is a purely client-side, static web application: a “Cosmic Mindscape” personality assessment tool.
• Purpose: present a UI in the browser (index.html + app.js + main.css), load question data (questions.json), run a scoring algorithm (score_calculator.js), and display results via static HTML pages (types/*.html, resources/*.html).
File Structure Analysis
• Root assets:
• index.html – test entry point
• app.js – UI logic, question flow
• score_calculator.js – core scoring engine
• questions.json – raw question data
• main.css + proximanova_light.otf – styling and font
• Resource pages (resources/): static theory/history acknowledgments.
• Type pages (types/): 16 static HTML pages with accompanying JS & CSS for the cognitive-function carousel.
Core Components
A. User’s Web Browser (Client)
B. Static Hosting Layer
• Could be GitHub Pages, Netlify, any CDN or web server serving static files.
C. Static Assets
1. index.html
2. main.css, proximanova_light.otf
3. app.js
4. score_calculator.js
5. questions.json
6. resources/*.html + resources/resources.css + resources/theory.js
7. types/*.html + types/*.js + types/Type.css
D. Data Store (Static JSON)
E. Scoring Engine (Module)
• score_calculator.js logic:
• Raw Function Scoring
• Attitude Preference Integration
• Intra-Pair Suppression
• Global Suppression (sigmoid)
• Temperament & I/E Boosts
• Function-Stack Matching → Final Type
F. Navigation Flow
• After scoring, redirect to the appropriate types/<type>.html page
• Links to resources/*.html for theory/history
Relationships & Interactions
1. Browser → (HTTP GET) → Static Hosting → Serves index.html, CSS, JS, JSON
2. index.html + app.js loads questions.json via XHR/Fetch
3. app.js passes raw answers to score_calculator.js
4. score_calculator.js pulls in question weights, runs algorithm, returns a “type code”
5. app.js triggers client-side navigation to types/{code}.html
6. Browser fetches types page and its local CSS/JS to render the results
7. User can click nav items to fetch resources/*.html
Architectural Patterns & Design Principles
• Static Single-Page Application (SPA) style for the test flow, but with static post-results pages.
• Separation of concerns:
• UI & state management in app.js
• Pure function-based scoring in score_calculator.js
• Data in JSON
• Presentation in CSS/HTML
• No server-side logic; fully decoupled hosting of assets.