System Overview
The DTech Eligibility Checker is a web-based application (wrapped optionally as an Android APK) designed to help students evaluate their likelihood of acceptance into various South African university courses based on their National Senior Certificate (NSC) or equivalent marks.
The core purpose is to take a user's academic performance (subjects, marks) and compare it against the admission criteria (APS, FPS, subject-specific requirements) for multiple universities. It outputs an "Eligibility Score" (a percentage likelihood) along with a detailed breakdown of how that score was calculated.
How it Works (The Workflow)
1. User Input:
- The user opens
index.html. - They select their subjects from a dynamically generated dropdown list (powered by
helper.json, which standardizes subject names). - They input their percentage mark for each subject.
- The system calculates the corresponding NSC level for each mark based on standard South African grading (80-100% = 7, 70-79% = 6, etc.).
- The user's total Admission Point Score (APS) is calculated automatically. *Note: Life Orientation is explicitly excluded from the total APS calculation.*
2. Data Storage & Navigation:
- When the user confirms their marks, the data (subjects, percentages, calculated APS/FPS) is saved locally in the browser's
localStorage. - The user can then navigate to different university-specific pages (e.g.,
wits.html,uct.html).
3. Evaluating Eligibility on University Pages:
- When a university page (e.g.,
wits.html) loads, it retrieves the user's data fromlocalStorage. - It fetches the corresponding university JSON data file (e.g.,
wits.json), which contains all faculties, courses, and their specific requirements. - The user selects a specific course from a dropdown list.
- The system displays the course details (required APS, required subjects, duration).
- When the user clicks "Check My Eligibility", the core logic (in
calculator.js) runs a two-stage evaluation: - Stage 1 (Hard Fail): Checks if the user is missing a strictly required subject or if their mark is critically below the minimum requirement (>15% below). If so, it returns a 0% likelihood.
- Stage 2 (Weighted Likelihood): If they pass Stage 1, a percentage likelihood is calculated using a weighted formula based on Subject Exceedance (60%) and APS/FPS Strength (40%).
Detailed File Breakdown
Frontend & Logic Files
-
index.html - Purpose: The main entry point and landing page of the application.
- Functionality: Handles the user interface for inputting subjects and marks. It calculates the user's base APS. It saves this state to
localStorageso it persists across other pages. It also provides navigation links to the individual university pages. It loads thehelper.jsonto populate the subject dropdowns cleanly. - Styling: Follows the "dtech vibe" - a dark theme with black/grey backgrounds (
#0b0c10,#1f2833) and blue accents (#66fcf1,#45a29e). -
calculator.js - Purpose: The core engine of the application. Contains all the heavy lifting for eligibility calculations.
- Functionality:
-
checkSubjectMatch(): A complex function that compares the subject required by the course against the subjects the user entered. It useshelper.jsonto handle aliases (e.g., matching "Maths" to "Mathematics" or handling "Mathematical Literacy" safely without false positives). It also groups alternative requirements (e.g. subjects separated by "OR"). -
calculateLikelihood(): The main algorithm. It takes the course requirements and the user's stats and performs the Stage 1 and Stage 2 checks mentioned above. It generates the final percentage score, a textual reason/feedback string based on bands (<35%, <50%, <70%, >=70%), and a detailed "breakdown" array showing exactly which requirements passed or failed. -
helper.json - Purpose: A standardization dictionary for subject names.
- Structure: A JSON object where keys are the main, standard subject names (e.g., "Agricultural Sciences") and values are arrays of possible variations or aliases found across different university prospectuses (e.g., ["Agricultural Sciences", "Agricultural", "Agric Sci"]).
- Usage: Used by
calculator.jsto intelligently match user input to course requirements.
Data Files (University JSONs)
These files are the structured data representing the admission requirements for various universities. They are generated by parsing unstructured PDFs (handled by other scripts not actively detailed here, but presumed to use pdfplumber/PyMuPDF).
-
wits.json,stellenbosch.json,tut.json,uct.json,ul.json,ump.json,univen.json,up.json - General Structure:
{"Faculty Name": [{"course_name": "...", "course_code": "...", "aps": "...", "required_subjects": [{"subject": "...", "level": "...", "percentage": "..."}]}]} - Variations & Nuances (managed by
calculator.js): - Scoring Systems: Most use standard
aps(Admission Point Score). UCT (uct.json) usesfps(Faculty Point Score, often sums of percentages like 400+). UMP usesaps_range. - Requirements: Some specify requirements purely by NSC
level(1-7), others bypercentage(e.g., "60%"), and some have both. Some levels in UCT actually represent percentages (e.g., "level": "70"). The calculator logic handles these discrepancies dynamically.
Generation Script
-
generate_uni_pages.py - Purpose: Automates the creation of the individual university HTML files.
- Functionality: It contains a massive Python string representing a generalized HTML template. It loops through a defined list of universities (mapping names to their JSON files) and writes out files like
wits.html,uct.html, etc. - Injected Logic: The template it generates includes embedded JavaScript that reads from
localStorage, fetches the specific university's JSON file, builds the course dropdown dynamically, displays course details, and wires up the "Check My Eligibility" button to callcalculator.js.
Generated HTML Files
-
wits.html,stellenbosch.html,tut.html,uct.html,ul.html,ump.html,univen.html,up.html - Purpose: The specific viewing pages for each university.
- Functionality: Generated entirely by
generate_uni_pages.py. They do not contain unique logic themselves; they merely load the shared template logic but point to their specific.jsondata source.
Android Application Wrapper (`app/` directory)
The web application is made available as a native Android app using a WebView container.
-
app/src/main/java/com/dtech/uni/MainActivity.java - Purpose: The main entry point for the Android app.
- Functionality:
- Sets up an Android
WebViewpointing to the hosted URL of the application (https://uni.dtech-services.co.za). - Enables crucial web settings: JavaScript (
setJavaScriptEnabled), DOM Storage (setDomStorageEnabled- critical solocalStorageworks across the app), and mixed content. - Custom URI Handling: Contains an overridden
WebViewClient(shouldOverrideUrlLoading). This is specifically implemented to handle non-standard URL schemes (likeintent://orshein://). If the user clicks an ad or external link that requires launching a native app (like an ad redirecting to a store), this logic intercepts it and fires an AndroidIntentto open the external app properly, preventing the WebView from crashing on unknown protocols.