🔍
← Back to the value chain

🧭 Mentorship plan

for Delegation and Routing Testbed

Written from the value chain only: the original document was not available.

This mentorship plan guides students through building a modular simulation platform for credit underwriting. It focuses on the impact of delegation and routing policies on financial KPIs like total cost, queueing delay, and decision accuracy, emphasizing reproducible, scientifically rigorous analysis through a command-line interface.

Pace rule: Each step starts with a question. The learner answers it in their own words, then does the task. A step's typical days are the time given. A learner who has not answered by then is not chased: the mentor moves on to learners who are moving, and the door stays open for when they return.

Who this is for

Final-year university students with foundational programming skills, ideally in Python, interested in computational finance, simulation, or organizational design.

Starting point

The team must be proficient in Python, including object-oriented programming, basic data structures (lists, dictionaries), and file I/O. Familiarity with `numpy` and `matplotlib` is beneficial but can be developed.

Components

Component name
M1 Deal Population Generator
Skill areas
  • Data engineering
  • Computational Finance
Why it matters
This component is the source of all simulated credit deals, defining the inputs for the entire value chain. Its ability to generate reproducible, configurable, and diverse deal populations is crucial for rigorous testing and simulating various market conditions.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is a random seed, and how does using it ensure reproducibility in random number generation?Python `random` module documentation or `numpy.random` documentationWrite a Python script that generates a list of 5 random numbers without setting a seed, then generates another list of 5 random numbers after setting a fixed seed, and finally generates a third list using the same fixed seed. Explain the differences.Learner's explanation of random seeds and their effect on reproducibility. Script output showing two distinct lists for unseeded generation and two identical lists for seeded generation.1
2How do you implement an exponential distribution for simulating arrival times in Python, and what parameters does it typically take?`numpy.random.exponential` documentationImplement a Python function `generate_arrival_time(rate)` that uses an exponential distribution to return an inter-arrival time. Generate 100 samples and visualize their distribution using a histogram.Learner's explanation of exponential distribution parameters (e.g., scale/rate). Function correctly implemented. Histogram showing an exponentially decaying shape for the generated samples.2
3Why is it important for deal attributes like 'exposure' to have configurable statistical distributions, and how can you implement this for a log-normal distribution?`numpy.random.lognormal` documentation, project's configuration schemaCreate a `DealGenerator` class that takes a configuration dictionary upon initialization. Implement a method `generate_exposure()` that uses `numpy.random.lognormal` with `mean` and `sigma` parameters read from the configuration dictionary. Test with two different configurations.Learner's explanation of how configurable distributions enable simulating diverse market conditions. Class correctly initializes and `generate_exposure` produces log-normally distributed samples, with mean/std varying according to the configuration.3
4What is the benefit of encapsulating deal generation logic within a `DealGenerator` class?Python object-oriented programming concepts (classes, methods)Extend the `DealGenerator` class to include methods for generating all key deal attributes (arrival times, exposure, tenor, sector, etc.) based on configurable distributions. Ensure the class constructor takes a random seed and a configuration dictionary.Learner's explanation of the benefits of OOP (encapsulation, modularity). A `DealGenerator` class that correctly initializes and has methods to produce all required deal attributes based on its configuration.2
5How do you verify that identical seed and configuration produce bit-identical deal populations on different runs?Python unit testing frameworks (e.g., `unittest` or `pytest`) documentationWrite a unit test that instantiates two `DealGenerator` objects with the *same* seed and configuration. Generate a sequence of 10 deal objects from each and assert that each corresponding deal in the two sequences is identical (all attributes match).Learner's explanation of the verification process. A passing unit test that confirms bit-identical deal populations for the same seed and configuration.3
6Which approach would you choose for simulating a fixed number of deals versus a continuous stream, and why?Project's 'adaptations' for M1, Python generator functionsModify the `DealGenerator` to support both generating a fixed number of deals (`generate_n_deals(count)`) and yielding a continuous stream (`deal_stream()`) based on configuration. Justify your choice of implementation (e.g., using a generator function for the stream).Learner's explanation of the chosen approach and its benefits (e.g., memory efficiency for streams). `DealGenerator` produces `N` deals when `generate_n_deals(N)` is called, and `deal_stream()` yields deals indefinitely or until a condition.3
Common mistakes
  • Not properly initializing or managing random seeds, leading to non-reproducible runs.
  • Hardcoding distribution parameters instead of making them configurable.
  • Incorrectly implementing statistical distributions or misunderstanding their parameters.
  • Not ensuring bit-identical outputs, which is a core requirement for reproducibility.
Component name
N09 Shari'ah Opinion Stub
Skill areas
  • Business and operations
  • Data engineering
Why it matters
This stub simulates a critical external dependency in Islamic finance without implementing complex domain logic. It allows the simulation to account for the delays and refusal rates associated with Shari'ah compliance, impacting overall deal throughput and costs.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is the purpose of a 'stub' in software development, and why is it used for the Shari'ah opinion in this project?Software engineering principles, 'engineering compromise' in value chain documentCreate a basic Python function `get_shariah_opinion()` that simulates an instantaneous approval by returning the string 'Approved' immediately. Briefly explain the role of a stub here.Learner's explanation of stubs (e.g., for isolation, simplifying dependencies). Function returns 'Approved' instantly.1
2How do you introduce a configurable refusal rate into the stub, ensuring it is applied probabilistically?Python `random.random()` documentation, project's 'key variable' for N09Modify `get_shariah_opinion()` to accept a `refusal_rate` parameter (0-1). Based on this rate, randomly return 'Rejected' or 'Approved'. Test by running 100 times and counting approvals/rejections.Learner's explanation of how `refusal_rate` works. Function correctly returns 'Rejected' approximately `refusal_rate` percent of the time over a large number of calls (e.g., within 5% deviation for 100 calls).2
3Why is it important to model the delay as a distribution rather than a fixed value for simulation accuracy?`numpy.random.exponential` documentation, 'adaptations' for N09Integrate a delay mechanism into `get_shariah_opinion()`. The delay should follow an exponential distribution with a configurable mean (e.g., in seconds). Use `time.sleep()` to simulate this delay. Measure the average delay over 100 calls.Learner's explanation of why variable delays are more realistic. Function correctly introduces a delay, and the average delay over 100 calls is within 10% of the configured mean.2
4What are the precise input and output requirements for this stub, and how should it conform to a predefined interface?Project's 'build prompts' for N09, Python class definitionRefactor the stub into a `ShariahOpinionStub` class with a `get_opinion(deal_id)` method. This method should accept a `deal_id` (a string for now) and return a dictionary with keys 'disposition' (string: 'Approved'/'Rejected') and 'delay_duration' (float: actual simulated delay).Learner's explanation of the stub's interface. `ShariahOpinionStub` class correctly instantiates and `get_opinion` returns a dictionary matching the specified keys and value types.2
5What if the configured delay or refusal rate parameters are outside a valid range (e.g., negative delay, refusal rate > 1)? Which error handling approach would you choose and why?Python exception handling, best practices for configurable parametersImplement parameter validation within the `ShariahOpinionStub`'s constructor. If `refusal_rate` is not between 0 and 1, or `mean_delay` is negative, raise a `ValueError`. Justify the choice of raising an exception.Learner's explanation of error handling and justification for `ValueError`. Code raises `ValueError` with a clear message for invalid parameters, and runs correctly for valid parameters.2
Common mistakes
  • Adding complex, 'intelligent' logic to the stub, violating its purpose.
  • Not making parameters (delay, refusal rate) configurable.
  • Using fixed delays instead of distributed delays.
  • Returning inconsistent data types or not adhering to the defined output interface.
Component name
M7 Replay Harness
Skill areas
  • Data engineering
  • Cloud computing
  • AI
Why it matters
This module is the core orchestrator for running simulations, enabling systematic comparative analysis. It ensures that different configurations can be run with the same inputs, generating reproducible results and visualisations necessary for scientific inquiry.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is a configuration hash, and why is it critical for ensuring the reproducibility and traceability of simulation results?Cryptographic hashing functions (e.g., `hashlib` in Python), version control systems conceptsWrite a Python function `generate_config_hash(config_dict)` that takes a dictionary, converts it to a canonical string representation (e.g., sorted JSON), and returns an MD5 hash of this string. Test with identical and slightly different dictionaries.Learner's explanation of configuration hashes for reproducibility. Function produces identical hashes for identical config dictionaries (after canonicalization) and different hashes for even minor changes.1
2How do you orchestrate running a simulation loop with different configurations from a command-line script?Python `argparse` documentation, basic script executionCreate a main Python script that accepts a path to a directory containing multiple configuration files (e.g., YAML or JSON). For each file, load the configuration, generate its hash, and print the hash along with the file's name. (Don't run the actual simulation yet).Learner's explanation of orchestration using a script. Script correctly reads configuration files from a directory, generates and prints hashes for each, and handles basic command-line arguments.2
3Why is it necessary to link all simulation results directly to their configuration hash and random seed?Project's 'procedure' and 'key variable' for M7Modify the script from Step 2. For each configuration, call a dummy `run_simulation(config_data, seed)` function (which just returns a mock 'total_cost' and 'queue_delay'). Save these mock results, along with the config hash and seed, into a unique JSON file per run in an `output/results/` directory.Learner's explanation of result traceability. Script generates distinct JSON files for each run, each containing the config hash, seed, and mock results.3
4How can `matplotlib` be used to generate a basic line chart comparing a key performance indicator (KPI) across multiple simulation runs?`matplotlib.pyplot` documentation (e.g., `plot`, `xlabel`, `ylabel`, `title`, `savefig`)Add a new function to your script that loads the results from all JSON files in `output/results/`. Extract a specific KPI (e.g., 'total_cost') and a varying configuration parameter (e.g., 'refusal_rate' from N09). Generate a line plot showing 'total_cost' vs. 'refusal_rate' and save it as a PNG image.Learner's explanation of basic plotting. Script generates a correct line plot in PNG format, with labeled axes and a title, based on loaded simulation results.3
5What is a 'frontier plot' in the context of simulation, and how can it visualize trade-offs between two conflicting KPIs?Economic concept of Pareto frontier, `matplotlib.pyplot.scatter` documentationExtend the plotting utility to create a scatter plot. Each point should represent a simulation run, with x-axis as 'queue_delay' and y-axis as 'total_cost' (using your mock data). Label the points with their config hashes. Visually identify and explain the 'Pareto frontier'.Learner's explanation of frontier plots and Pareto optimality. Script generates a scatter plot showing the trade-off between two KPIs, with points labeled for identification.4
6How robust is the configuration hashing mechanism to minor, non-impactful changes (e.g., key order, whitespace) in config files, and which trade-off (hash speed vs. robustness) would you prioritize for scientific reproducibility?`json.dumps` `sort_keys` and `indent` parameters, `hashlib` moduleRefine `generate_config_hash` to use `json.dumps` with `sort_keys=True` and a consistent `indent` to ensure canonical representation regardless of original file formatting. Test if reordering keys in a config file yields the same hash. Justify your chosen trade-off.Learner's explanation of hashing robustness and justification for the chosen trade-off. Refined hashing function produces identical hashes for semantically identical but syntactically different (e.g., key order changed) config files. Test demonstrating this passes.3
Common mistakes
  • Not canonicalizing configuration dictionaries before hashing, leading to different hashes for semantically identical configs.
  • Failing to link simulation outputs to their specific configurations and seeds, hindering reproducibility.
  • Generating low-quality, unlabelled, or uninterpretable plots.
  • Ignoring the need for structured output directories for results.
Component name
M3 Routing Policies
Skill areas
  • Platform engineering
  • Data engineering
  • Business and operations
Why it matters
Routing policies dictate how credit applications flow through the organizational tiers. This module's pluggable design allows flexible testing of different routing strategies, which directly impacts queueing, resource utilization, and decision efficiency.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is a Python 'interface' (e.g., using Abstract Base Classes), and why is it beneficial to define one for routing policies?Python `abc` module documentation, design patterns (e.g., Strategy Pattern)Define an Abstract Base Class `IRoutingPolicy` with an abstract method `route_deal(deal, organization)`. Create a concrete `SimpleVerticalPolicy` class that inherits from `IRoutingPolicy` and has a placeholder implementation for `route_deal` (e.g., always returning tier 1).Learner's explanation of interfaces and their benefits (e.g., enforced structure, interchangeability). `IRoutingPolicy` is correctly defined as an ABC, and `SimpleVerticalPolicy` inherits and implements the abstract method.2
2How would a `VerticalPolicy` route a deal based on a `delegated_authority_matrix` data structure?Project's 'key variable' for M3, `M2 Organisation Model` detailsImplement a `VerticalPolicy` class. Its `route_deal(deal, organization)` method should determine the minimum required tier for a mock `deal` (e.g., based on its 'exposure' attribute) by consulting a provided `organization` object which holds the `delegated_authority_matrix`.Learner's explanation of vertical routing logic. `VerticalPolicy` correctly routes a deal to the appropriate tier (e.g., 1, 2, or 3) based on its exposure value and the `delegated_authority_matrix` structure.3
3What are 'escalation predicates', and how can they be evaluated as flexible data rules rather than hardcoded logic?Project's 'adaptations' for M3, Python expression evaluation (`eval` or custom parser)Define a simple data structure for a predicate (e.g., `{'attribute': 'deal_type', 'operator': '==', 'value': 'Complex'}`). Write a function `evaluate_predicate(deal, predicate_data)` that dynamically evaluates this predicate against a given `deal` object (e.g., `deal.deal_type == 'Complex'`).Learner's explanation of predicates as data-driven rules. `evaluate_predicate` correctly returns `True` or `False` based on evaluating the predicate data against various mock deals.3
4Why is logging individual predicate evaluations important for understanding routing decisions and for later audit trails?Project's 'procedure' for M3, logging best practicesEnhance the `VerticalPolicy`'s `route_deal` method to log each predicate evaluation (deal ID, predicate evaluated, outcome, and timestamp) to an in-memory list (which simulates a logging utility).Learner's explanation of the importance of logging for auditability and debugging. The enhanced `VerticalPolicy` produces a clear, timestamped log for each predicate evaluation made during routing.2
5How does `LateralPolicy` differ from `VerticalPolicy` in its core routing logic, and how would you implement a basic version?Project's 'key variable' for M3Implement a `LateralPolicy` class. Its `route_deal` method should first attempt to route a deal vertically (e.g., using the `delegated_authority_matrix`), but if a simulated condition (e.g., 'primary decision maker busy') is met, it should attempt to route to a peer at the same tier or a slightly different lateral path.Learner's explanation of lateral routing. `LateralPolicy` demonstrates a routing decision that involves a 'horizontal' transfer or re-routing under specific conditions, distinct from purely vertical escalation.4
6What if routing rules contain conflicts or ambiguities? How would you design a conflict resolution strategy, and what trade-offs (e.g., strict hierarchy vs. first-match) does it involve?Rule engine design principles, logical conflict resolutionModify one of your routing policies (e.g., `VerticalPolicy`) to handle a scenario where a deal meets conditions for *two different* tiers. Implement a conflict resolution strategy (e.g., always choose the highest tier, or enforce an explicit priority order of rules) and explain your choice and its implications.Learner's explanation of conflict resolution strategy and trade-offs. The modified routing policy correctly handles conflicting rules according to the defined strategy, consistently assigning a deal to a single, unambiguous tier.3
Common mistakes
  • Hardcoding routing decisions instead of using data-driven configurations.
  • Not defining a clear interface, making policies difficult to swap.
  • Inadequate logging of routing decisions and predicate evaluations.
  • Overlooking potential conflicts or ambiguities in rule sets.
Component name
M4 Decision and Outcome Model
Skill areas
  • Computational Finance
  • AI
  • Data engineering
Why it matters
This component simulates the decision-making process and its financial consequences, including errors. It's crucial for understanding the impact of competence and delegation on actual business outcomes like profit, loss, and error costs.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is 'latent creditworthiness' in the context of a credit deal, and how does it relate to the 'true' outcome of a loan?Project's 'key variable' for M4, basic credit risk conceptsCreate a `DecisionModel` class. Implement a `make_decision(deal, competence_level)` method. For now, it should just return a fixed 'Accept' decision. The `deal` object should have a `latent_creditworthiness` attribute (a float between 0 and 1, where 1 is perfect).Learner's explanation of latent creditworthiness. `DecisionModel` class initialized, and `make_decision` method returns 'Accept' for a mock deal with `latent_creditworthiness`.2
2How do you model decision errors, ensuring the probability of error depends on both the decision-maker's competence and the deal's complexity?Project's 'adaptations' for M4, basic probabilityEnhance `make_decision` to also take `deal_complexity` (float 0-1). Implement an error probability function (e.g., `error_prob = max(0, deal_complexity * (1 - competence_level))`). Based on this probability, the decision `make_decision` returns should occasionally be the opposite of the 'correct' decision (based on `latent_creditworthiness`).Learner's explanation of error modeling. Running `make_decision` 100 times with low competence/high complexity shows a noticeable error rate (e.g., within 10% of expected probability).3
3What is the procedure for verifying that the decision model yields zero decision errors when competence is set to 'perfect' (its maximum value)?Project's 'procedure' for M4, Python unit testingWrite a unit test for the `DecisionModel`. Instantiate it with `competence_level=1.0` (perfect competence). Simulate 100 deals with varying `latent_creditworthiness` and `deal_complexity`. Assert that no decision errors occur (i.e., the decision always aligns with the true creditworthiness).Learner's explanation of the test procedure. The unit test passes, demonstrating zero decision errors when competence is perfect.2
4What are Probability of Default (PD) and Loss Given Default (LGD), and how do they determine the financial outcome of an accepted or rejected deal?Financial risk modeling concepts (PD, LGD), project's 'key variable' for M4Create an `OutcomeModel` class with a `calculate_financial_outcome(deal, actual_decision)` method. Given the `deal`'s `latent_creditworthiness` (used as PD) and a configurable `LGD` value, simulate if the deal defaults and calculate profit/loss (considering 'margin from accepted deals').Learner's explanation of PD and LGD. `OutcomeModel` correctly calculates a financial outcome (profit or loss in PKR) based on the deal's true creditworthiness, LGD, and a simulated default event.3
5Can the model incorporate different types of errors (Type I: Wrong Accept vs. Type II: Wrong Reject) with distinct cost implications?Project's 'deep questions' for M4, decision theoryModify `DecisionModel` to explicitly classify a decision error as `ERROR_TYPE_I` (wrong accept) or `ERROR_TYPE_II` (wrong reject). Modify `OutcomeModel` to accept this error type and apply different financial consequences (e.g., a higher cost for `ERROR_TYPE_I`).Learner's explanation of Type I/II errors and their distinct implications. `DecisionModel` correctly identifies error types, and `OutcomeModel` applies different (asymmetric) financial consequences based on the error type.4
Common mistakes
  • Confusing latent creditworthiness with an observable risk score.
  • Using overly simplistic or unrealistic error probability functions.
  • Not properly simulating default based on latent creditworthiness and LGD.
  • Failing to distinguish between Type I and Type II errors, which have very different costs.
Component name
M2 Organisation Model
Skill areas
  • Business and operations
  • Data engineering
  • Platform engineering
Why it matters
This component defines the organizational structure, including staff tiers, capacities, competence, and most importantly, the Delegated Authority Matrix. It allows for dynamic configuration of organizational policies, which is central to the simulation's purpose.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What does it mean for the Delegated Authority Matrix to be 'as data', and how can it be represented in Python?Project's 'sovereign anchor' and 'adaptations' for M2, Python dictionaries/listsCreate a Python dictionary representing a simple `delegated_authority_matrix` (e.g., mapping 'exposure_limit' to `{'tier1': 100000, 'tier2': 500000}`). Write a function `get_required_tier(deal_exposure, matrix)` that returns the minimum tier required based on a deal's exposure.Learner's explanation of data-driven configuration. Function correctly identifies the minimum required tier for a given deal exposure using the provided dictionary.2
2How can the delegated authority matrix be loaded from an external configuration file (e.g., YAML or JSON) and updated at runtime without recompilation?Python `yaml` or `json` library documentation, project's 'procedure' for M2Create an `Organization` class. Its constructor should load the `delegated_authority_matrix` from a specified YAML or JSON file. Implement a `reload_authority_matrix(file_path)` method that reloads the matrix from the file. Test by changing the file and calling reload.Learner's explanation of runtime configuration updates. `Organization` class correctly loads the matrix from a file, and `reload_authority_matrix` reflects changes from the file immediately without restarting the application.3
3Why are customizable competence functions crucial for accurately modeling decision error rates across different tiers and deal complexities?Project's 'adaptations' and 'key variable' for M2, function as a parameterAdd a `competence_function` attribute to the `Organization` class. This attribute should be a callable (e.g., a lambda or a method) that takes `tier` and `deal_complexity` and returns a competence score (0-1). Implement a default linear competence function.Learner's explanation of customizable competence functions. `Organization` class stores and uses the `competence_function`, which returns varying competence scores based on tier and complexity.3
4What are the implications of using different service-time distributions (e.g., fixed, exponential, normal) for roles/tiers on queueing behavior and capacity utilization?Queueing theory basics, `numpy.random` distribution functionsExtend the `Organization` class to store `service_time_distribution` (e.g., 'fixed', 'exponential') and `service_time_parameter` per tier. Implement a `get_service_time(tier)` method that returns a service duration based on the configured distribution for that tier.Learner's explanation of how service-time distributions impact queueing. `get_service_time` method correctly returns service times according to the configured distribution type and parameter for each tier.3
5What if the delegated authority matrix contains conflicting or ambiguous rules (e.g., overlapping or contradictory exposure limits)? How would you design a robust validation mechanism, and what are its implications for operational resilience?Data validation best practices, organizational policy designImplement validation logic within the `reload_authority_matrix` method. This logic should check for overlaps, gaps, or inconsistencies in the exposure limits for different tiers. If an issue is found, raise a descriptive `ValueError` and prevent the matrix from being loaded. Justify the importance of such validation.Learner's explanation of validation importance for resilience. Validation logic correctly identifies and raises `ValueError` for invalid authority matrix configurations (e.g., overlapping ranges), and loads valid ones successfully.4
Common mistakes
  • Hardcoding organizational rules or competence models instead of making them data-driven.
  • Failing to implement mechanisms for runtime updates of policies.
  • Ignoring the impact of different service-time distributions on simulation realism.
  • Lack of robust validation for configuration data, leading to subtle simulation errors.
Component name
N07 Learned Risk Model Stub
Skill areas
  • AI
  • Computational Finance
  • Data engineering
Why it matters
This stub simulates a learned risk model, which is an external dependency, by returning a noisy function of the true latent creditworthiness. This is crucial for preventing the simulation from 'fitting' its own synthetic data, ensuring the robustness of its findings.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What does 'noisy function of latent variable' mean in the context of a risk model stub, and what is its basic purpose?Project's 'sovereign anchor' for N07, basic signal processing conceptsCreate a `RiskModelStub` class. Its `predict_risk(latent_creditworthiness)` method should return `1 - latent_creditworthiness` (where 1 means no risk). Explain the simple inverse relationship.Learner's explanation of the noisy function concept. `predict_risk` method correctly returns a value inversely proportional to `latent_creditworthiness`.1
2How do you introduce a configurable level of random noise to the predicted risk score?`numpy.random.normal` documentation, project's 'key variable' for N07Add a `noise_level` parameter (e.g., standard deviation) to the `RiskModelStub` constructor. Modify `predict_risk` to add a random value drawn from a normal distribution with `mean=0` and `std=noise_level` to the base risk score. Test with different `noise_level` values.Learner's explanation of noise introduction. Running `predict_risk` 100 times with the same `latent_creditworthiness` but a non-zero `noise_level` shows varying risk scores, centered around the base value, with spread proportional to `noise_level`.2
3Why is it crucial that 'no intelligence' be added to this stub, specifically regarding preventing the simulation from being 'fit' to its own synthetic defaults?Project's 'procedure' for N07, machine learning overfitting conceptsExplain in your own words how adding random, uncorrelated noise to the output of a deterministic function (the latent creditworthiness) prevents any subsequent 'learned' model from perfectly reconstructing the original latent variable or 'recovering the generator'.Learner's clear explanation of why the stub must remain unintelligent to avoid overfitting and ensure robust simulation analysis.2
4What are the data inputs and output format expected from a fully implemented learned risk model that would eventually replace this stub?Machine learning model interfaces, project's 'deep questions' for N07Define a clear Python interface (e.g., using a type hint or an ABC) for a `RealRiskModel`. Specify that its `predict_risk` method would take a `deal_features_dict` (representing all observable deal attributes) and return a single `float` risk score. Ensure the `RiskModelStub` currently adheres to this output type.Learner's explanation of the future risk model interface. A clearly defined interface (e.g., ABC or detailed type hint) for the `RealRiskModel`, and verification that `RiskModelStub` returns a single float.2
5Which statistical distribution and magnitude of noise would best reflect real-world model uncertainty, and why would you choose it over a simple Gaussian distribution?Financial modeling literature (e.g., distributions with heavy tails), statistical distributionsResearch alternative noise distributions (e.g., Student's t-distribution for heavier tails, or a bounded distribution) that might better represent financial model uncertainty. Implement one such alternative as a configurable option in your `RiskModelStub`. Justify your choice.Learner's explanation of alternative noise distributions and justification for choice. `RiskModelStub` includes a configurable option to use an alternative noise distribution (e.g., Student's t), and it is correctly implemented.3
Common mistakes
  • Introducing 'intelligence' (e.g., conditional logic, data transformation) into the stub.
  • Not making the noise level configurable.
  • Failing to understand the purpose of the stub in preventing simulation bias.
  • Returning inconsistent data types or not adhering to the future interface.
Component name
M5 Cost Accounting
Skill areas
  • Computational Finance
  • Data engineering
  • Business and operations
Why it matters
This module quantifies all costs within the simulation: delay, decision error, and capacity. Its strict separation and configurability of cost streams are vital for isolating impacts and performing detailed financial analysis of different delegation policies.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What are the three strictly separated cost streams identified in the project, and why is their separation important?Project's 'sovereign anchor' and 'key variable' for M5Create a `CostTracker` class with internal attributes to store `total_delay_cost`, `total_error_cost`, and `total_capacity_cost`. Implement three methods: `add_delay_cost(amount)`, `add_error_cost(amount)`, and `add_capacity_cost(amount)` that update these attributes.Learner's explanation of cost stream separation and its importance. `CostTracker` class correctly maintains separate totals for each cost stream and updates them via dedicated methods.1
2How do you calculate delay cost, including a client-attrition hazard, from parameters like delay duration and deal value?Project's 'key variable' for M5, basic financial modelingImplement a `calculate_delay_cost(deal_value, delay_days, daily_attrition_rate, cost_per_day_of_delay_pk_r)` function. This should calculate a direct cost per day plus an attrition-related cost (e.g., `deal_value * daily_attrition_rate * delay_days`). All costs should be in PKR.Learner's explanation of delay cost components. Function correctly calculates total delay cost in PKR based on all specified parameters.3
3Why are decision-error costs asymmetric for 'wrong accepts' vs. 'wrong rejects', and how would you implement this asymmetry?Project's 'key variable' for M5, financial loss conceptsImplement a `calculate_error_cost(error_type, deal_value, wrong_accept_factor, wrong_reject_factor)` function. `wrong_accept_factor` (e.g., 0.8 for 80% loss) should be typically higher than `wrong_reject_factor` (e.g., 0.1 for 10% opportunity cost). Return cost in PKR.Learner's explanation of asymmetric error costs. Function returns higher cost for 'wrong accept' than 'wrong reject' of the same deal value, using the configurable factors to express the asymmetry in PKR.3
4How is capacity cost (representing the price of senior time) quantified and tracked in the simulation?Project's 'key variable' for M5, hourly wage conceptsImplement a `calculate_capacity_cost(tier, time_spent_hours, hourly_rate_pk_r_per_tier)` function. This function should return the total cost in PKR for a given amount of time spent by a specific tier, considering the hourly rate for that tier.Learner's explanation of capacity cost. Function correctly calculates the cost in PKR based on tier, time, and hourly rate.2
5What is the procedure to verify that the three cost streams sum precisely to the reported total cost, and that individual streams can be independently zeroed out?Project's 'procedure' for M5, unit testing for numerical accuracyAdd a `get_total_cost()` method to `CostTracker`. Write a unit test: calculate costs for a scenario, verify `get_total_cost()` is the sum of individual streams. Then, set a specific cost factor (e.g., `daily_attrition_rate`) to zero and verify that *only* the corresponding stream's cost becomes zero.Learner's explanation of verification procedure. Unit test passes, confirming total cost is the precise sum, and individual cost streams can be isolated (zeroed out) by setting their parameters to zero.3
Common mistakes
  • Mixing cost types or not maintaining strict separation.
  • Incorrectly calculating attrition or asymmetric error costs.
  • Not providing parameters in PKR or clear units.
  • Failing to confirm that individual cost streams can be isolated, which is a key procedure requirement.
Component name
M6 Execution Ledger
Skill areas
  • Data engineering
  • Platform engineering
  • Cybersecurity
Why it matters
The execution ledger serves as an immutable, append-only event store, providing an auditable record of all simulation events. This is fundamental for debugging, reproducing results, and validating the internal consistency of the simulation's state transitions.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is an append-only event store, and why is this design choice important for an execution ledger?Database design principles (append-only logs), immutable data structuresCreate an `EventLedger` class with an internal Python list to store events. Implement an `append_event(deal_id, event_type, timestamp, data_dict)` method that adds a new event (as a dictionary) to the end of the list. Ensure events cannot be modified after being added.Learner's explanation of append-only stores and their benefits (e.g., immutability, auditability). `append_event` correctly adds events to the list, and attempts to modify past events raise errors or have no effect.2
2How do you implement two distinct internal storage strategies ('ordered' vs. 'batch') to demonstrate their impact on auditability?Project's 'adaptations' for M6, data buffering techniquesModify `EventLedger` to have a `persistence_mode` attribute ('ordered' or 'batch'). In 'ordered' mode, `append_event` adds directly. In 'batch' mode, it adds to a temporary buffer, and a `flush_batch()` method is needed to commit buffered events to the main list. Implement both.Learner's explanation of storage strategies. 'ordered' mode adds events instantly. 'batch' mode adds events to a buffer, and they only appear in the main ledger after `flush_batch()` is called.3
3Why is event ordering critical for auditability, and how does `audit_deal_events` verify this in 'ordered' persistence mode?Project's 'procedure' for M6, temporal logic, sorted listsImplement `audit_deal_events(deal_id)` for the 'ordered' mode. This method should retrieve all events for a given `deal_id` and verify that their timestamps are strictly increasing. It should return 'proven' if ordered, 'not proven' otherwise. Test with both correctly ordered and deliberately misordered events.Learner's explanation of event ordering importance. `audit_deal_events` correctly returns 'proven' for valid event sequences and 'not proven' for simulated out-of-order events in 'ordered' mode.3
4How should the `audit_deal_events` method behave in 'batch' mode to accurately represent scenarios where event ordering or provenance might be lost?Project's 'procedure' for M6Modify `audit_deal_events` so that when `persistence_mode` is 'batch', it *always* returns 'not proven' (or 'impossible to prove') for any deal whose events were batched, regardless of their timestamps. Explain why this simulates real-world batching limitations.Learner's explanation of batch mode auditability. `audit_deal_events` consistently returns 'not proven' for events processed in 'batch' mode, even if the underlying timestamps are sequential.2
5What cryptographic or hashing mechanisms could ensure the immutability and tamper-resistance of events in 'ordered' mode? Which trade-off (e.g., performance vs. security) would you choose, and why?Blockchain principles (hash chaining), `hashlib` module, cryptographic integrityImplement a basic hash chain for 'ordered' mode: each new event's `data` dictionary should include the hash of the *previous* event in the ledger. The `audit_deal_events` method in 'ordered' mode should now also verify this hash chain. Justify your chosen trade-off (e.g., using MD5 vs SHA256).Learner's explanation of hash chaining and justified trade-off. `EventLedger` successfully incorporates hash chaining, and `audit_deal_events` verifies the integrity of the chain, returning 'proven' for untampered sequences and 'not proven' for tampered ones.4
Common mistakes
  • Not understanding the concept of immutability in an event store.
  • Incorrectly implementing the distinction between 'ordered' and 'batch' persistence.
  • Failing to enforce or properly audit event ordering.
  • Overlooking the security/integrity aspects of an auditable ledger.
Component name
N03 Document Extraction Stub
Skill areas
  • Data engineering
  • AI
Why it matters
This stub simulates imperfect document processing, introducing configurable errors into extracted fields. This allows the simulation to explore how real-world data quality issues affect decision-making without implementing complex AI/OCR logic.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is the primary output of a document extraction process, and what should a placeholder module return to simulate this?Project's 'build prompts' for N03, basic data structuresCreate a `DocumentExtractorStub` class with an `extract_fields(document_id)` method. This method should return a fixed dictionary of mock extracted fields (e.g., `{'applicant_name': 'Ali Khan', 'deal_amount_pk_r': 50000}`).Learner's explanation of placeholder output. Stub returns a consistent dictionary of mock extracted fields.1
2How do you introduce a configurable `error_probability` to randomly inject errors into the extracted fields?Python `random.random()` documentation, project's 'key variable' for N03Add an `error_probability` parameter (0-1) to the `DocumentExtractorStub` constructor. For each field in the mock dictionary, randomly decide (based on `error_probability`) to either return the correct value or an 'erroneous' value (e.g., `None`, 'INVALID', or a negative number for amount).Learner's explanation of probabilistic error injection. Running `extract_fields` 100 times with `error_probability=0.2` results in approximately 20% of fields containing errors across all calls.2
3Why is it explicitly stated that 'no intelligence' may be added to this stub, and what would be the consequence of violating this rule?Project's 'procedure' for N03, role of stubs in simulationExplain in your own words the fundamental reason for keeping this stub 'unintelligent' (i.e., not adding OCR, NLP, or actual learning logic). Describe what would happen if such intelligence were added in the context of the overall simulation goals.Learner's clear explanation of the stub's boundary and the negative consequences (e.g., scope creep, unintended simulation bias) of adding intelligence.1
4What specific types of errors (beyond just a generic 'ERROR') does this stub need to simulate to represent real-world extraction failures?Project's 'deep questions' for N03, common data entry/extraction errorsExtend the error injection logic to simulate at least three distinct error types: 'missing data' (setting a field to `None`), 'incorrect value' (e.g., a random but wrong number), and 'format issue' (e.g., returning a string 'one lakh' for a numeric field). Make the error type chosen random or configurable.Learner's explanation of different error types. The stub now generates different types of errors (missing, incorrect, format) probabilistically, making the simulation more realistic.2
5What are the precise interface requirements for a fully functional document extraction module that would eventually replace this stub?API design principles, machine learning model integrationDefine a detailed Python interface specification (e.g., using a class with type hints for input/output) for a hypothetical `RealDocumentExtractor`. Specify expected inputs (e.g., raw document path/content), outputs (a structured dictionary), and potential error handling (e.g., `ExtractionError` exception). Ensure your stub conforms to this output specification.Learner's explanation of the detailed interface. A clear, well-defined interface for a `RealDocumentExtractor` is provided, and the stub's output adheres to its specifications.2
Common mistakes
  • Adding complex logic that goes beyond a simple error-injection stub.
  • Not making the error rate configurable or specific enough.
  • Failing to distinguish between different types of errors.
  • Inconsistent output format between the stub and a future real module.
Component name
Any User Interface Stub (via M7 Reporting)
Skill areas
  • Data engineering
  • Platform engineering
Why it matters
This component defines the project's output and reporting strategy. By focusing on command-line driven, file-based plots, it prioritizes reproducibility and analytical rigor over interactive user interfaces, aligning with the project's 'instrument-grade' simulation goal.
Ladder
StepQuestionWhere to lookStudent taskMentor checksTypical days
1What is the primary output format specified for the M7 Replay Harness, and how does it replace an interactive GUI for this project?Project's 'sovereign anchor' for UI Stub, `matplotlib.pyplot` documentationCreate a dummy Python function `generate_kpi_plot(data_points, output_filename)` that uses `matplotlib.pyplot.plot` to create a simple line chart from `data_points` (a list of numbers) and saves it as a PNG file at the specified `output_filename`.Learner's explanation of file-based reporting as GUI replacement. Function generates a basic PNG plot file correctly.1
2How do you ensure generated plots are 'publication-quality' and saved to a designated output directory with clear naming?`matplotlib.pyplot.savefig` parameters (`dpi`, `bbox_inches='tight'`), Python `os` module for path manipulationEnhance the plotting function. Add appropriate labels, a title, and a legend. Save the plot with a high DPI (e.g., 300) and `bbox_inches='tight'` to a `reports/plots/` subdirectory. The filename should include relevant parameters (e.g., `cost_vs_refusal_rate_config_ABC.png`).Learner's explanation of publication-quality plots. Function generates a high-resolution PNG plot with clear labels and title, saved in the specified directory with a descriptive filename.2
3Why is it important to include configuration hashes and relevant metadata directly on plots or in their captions for reproducibility?Project's 'build prompts' for UI Stub, M7 'key variable'Modify the plotting function to accept a `config_hash` and incorporate it directly into the plot title or as a text annotation on the plot. Explain why this is crucial for the scientific validity of the simulation.Learner's explanation of metadata on plots for reproducibility. Plot title or annotation clearly displays the `config_hash` of the simulation run(s) it represents.2
4What are the inherent limitations of static, file-based reporting for interactive exploration and drill-down analysis of simulation results?User interface design principles, data visualization typesList and explain at least three significant limitations of using static image files for reporting compared to an interactive dashboard. Focus on how it restricts user interaction and analysis capabilities.Learner's clear explanation of at least three limitations (e.g., no filtering, no zooming, no dynamic aggregation, no drill-down).1
5How would a future interactive user interface seamlessly integrate with the existing M7 output and configuration system, and which architectural pattern would you choose (e.g., REST API, direct database access)?Web application architecture (e.g., client-server, RESTful APIs), database integrationOutline a high-level architectural plan for how a web-based interactive UI could be added. This plan should explain how the UI would access simulation configurations, trigger runs, and consume/display results generated by M7 (or a future database storing M7 outputs). Justify your choice of integration pattern.Learner's explanation of a plausible architectural plan for UI integration, addressing data flow and interaction points with M7. Justification for the chosen architectural pattern is provided.3
Common mistakes
  • Generating low-quality plots without proper labels, titles, or legends.
  • Not including essential metadata (like config hashes) on plots, reducing reproducibility.
  • Underestimating the limitations of static reporting for exploratory analysis.
  • Providing an integration plan that ignores the existing file-based nature of M7 outputs.

Mentor guidance

  • Always emphasize the 'why' behind each step. Learners must understand the purpose before they write code.
  • Encourage learners to use AI tools for research and boilerplate code, but critically evaluate the output and explain it in their own words before implementation.
  • Stress the importance of test-driven development. Each task includes a check that often implies writing a small test.
  • Do not provide solutions directly. Guide learners to find answers themselves by pointing to the 'where_to_look' or asking follow-up questions.
  • Ensure all checks are measurable and unambiguous. 'Understand X' is not a check; 'Explain X in your own words, and show output Y' is.
  • Reinforce the project's focus on reproducibility and 'instrument-grade' simulation. This is a recurring theme.
  • Encourage modularity and clear separation of concerns, as outlined in the value chain document for each module.

Assumptions

  • This plan is based solely on the provided 'Value chain as built by InnoQuest' document, as no other source document was available.
  • Learners have access to Python 3.8+ and standard libraries like `numpy`, `matplotlib`, `pyyaml`, `json`, and `hashlib`.
  • Learners have a basic understanding of version control (e.g., Git) for code management.

Prepared by InnoQuest's AI from the uploaded document. Check every number before relying on it; assumptions are listed above.