Tutorials › Nonlinear Mixed-Effects Models (NLME) › Building a Candidate-Run Registry

Workflow and Reporting · Tutorial 788 of 797

Building a Candidate-Run Registry

Build a registry that distinguishes candidate models from execution attempts and keeps their configurations, results, logs, and files linked by stable identifiers.

Intermediate 10 min read

What You'll Learn

  • Distinguish a candidate model specification from an execution run.
  • Choose stable, unique identifiers for candidates and repeated attempts.
  • Design registry fields that link configurations, statuses, estimates, logs, and output files.
  • Track status changes without erasing failed or superseded runs.
  • Check registry links for missing, ambiguous, or contradictory records.
  • Recognize what a registry documents and what it does not validate.

Why Keep a Candidate-Run Registry?

NLME model development generates more than model code and a final estimate table. A candidate may be fitted repeatedly; a run may fail before returning estimates; and several files may be produced by one execution. Without a consistent way to connect those pieces, a result can become separated from the configuration that produced it. A candidate-run registry provides that connection: it is an organized record of candidate specifications, execution attempts, statuses, estimates, logs, and output files.

The central design decision is to distinguish what was specified from what was executed. A model candidate describes a particular model and its configuration. A run is one attempt to execute that candidate. The same candidate can therefore have multiple runs, for example if an attempt fails and is retried. Treating each attempt as a separate run prevents a retry from silently replacing the history of the first attempt.

Definition: A candidate-run registry is a structured record with unique identifiers for each candidate model and each execution attempt, plus explicit links from runs to candidates and from runs to their statuses, parameter estimates, logs, and output files. Each identifier names one record within the registry; it should not depend on a changeable description such as a model label or filename.

The registry is not itself a model specification, an estimation method, or a judgment that a fit is suitable. It makes the relationships among records explicit. The earlier material on versioning data, code, and model specifications provides the basis for recording which versioned inputs a candidate refers to; the registry adds a consistent index for the candidate and its runs.

Separate the Records Before Assigning Identifiers

A useful registry has at least two core record types. A candidate record describes the intended model configuration and points to its specification. A run record describes one execution attempt and points back to exactly one candidate. Associated estimates and files should also be linked to the run that produced or reported them, rather than stored as unlabelled values in a shared folder.

Identifiers should be unique within the registry and stable after assignment. A sequential identifier such as CAND-001 or a generated identifier can work. A readable label such as “two-compartment model” is useful as a description, but it is a poor primary key: the label may be reused, shortened, or revised. Do not encode mutable properties such as status in an identifier. A run that changes from running to failed must keep the same run ID.

RecordExample fieldsPurpose
Candidatecandidate_id, descriptive label, specification reference, data version, code version, configuration reference, creation dateIdentifies the model setup that is intended to be fitted
Runrun_id, candidate_id, start and end times, status, estimation settings, run directoryIdentifies one execution attempt and links it to its candidate
Estimaterun_id, parameter name, estimate, units, scale or parameterization, estimate stateRecords estimates returned by a particular run without losing their context
Artifactrun_id, artifact type, path, file name, availabilityLocates logs and output files associated with a run
Status eventrun_id, status, timestamp, optional notePreserves the sequence of state changes when status history is needed

A simple file can be sufficient for a small, carefully controlled analysis; a database may be more practical when many people or automated processes update the records. Either way, the structure matters more than the storage technology. Repeated fields such as multiple parameter estimates or several output files should be represented as multiple linked records, not compressed into an ambiguous text cell. The run ID is the link: each estimate and artifact record states which run it belongs to.

Worked Example: Assigning IDs to Candidates and Runs

Suppose a hypothetical analysis has two candidate configurations: a one-compartment model and a two-compartment model. The first attempt for each is assigned a run ID. Later, the one-compartment candidate is retried after its first attempt fails.

Assign candidate IDs CAND-001 and CAND-002, and run IDs RUN-001, RUN-002, and RUN-003. The links are:

  • CAND-001: one-compartment candidate; RUN-001 is its first attempt; RUN-003 is its retry.
  • CAND-002: two-compartment candidate; RUN-002 is its first attempt.

There are two candidate records and three run records. Each run points to one candidate, while CAND-001 points indirectly to two attempts through the run records. RUN-003 does not replace RUN-001: its distinct identifier preserves the fact that it is a separate execution. A descriptive label can be edited for clarity without changing any of these links.

Define What a Run Record Must Capture

The run record should answer, at minimum: which candidate was run, when the attempt started, whether it is still active or has ended, and where its associated records and files can be found. It should also record enough execution settings to interpret the attempt, such as the estimation method and configured iteration limit, when those settings are relevant to the analysis. Candidate-level settings belong with the candidate configuration; run-level settings belong with the attempt. Avoid duplicating fields without indicating which record is authoritative.

Use a controlled set of statuses rather than free-form phrases. For example, a workflow may use queued, running, succeeded, failed, and cancelled. Define each term locally and apply it consistently. “Succeeded” should mean the execution reached the workflow’s defined completion condition; it does not mean that the model is scientifically adequate, that all estimates are trustworthy, or that an independent review has approved the output.

When status history matters, retain events rather than only the latest value. For instance, a run can have a queued event followed by a running event and then a failed event. The current status can be displayed as failed, while the event records preserve how it reached that state. If an append-only event log is not practical, at least retain the final status and its time, and avoid overwriting the only record of a prior terminal attempt when creating a retry.

Worked Example: Recording a Failed Attempt and a Retry

In a hypothetical run, RUN-001 starts at 09:00, enters the running state, and stops at 09:12 with a numerical termination error. It produces a log file but no completed estimate table. A retry begins at 09:30 as RUN-003 and finishes at 09:44.

For RUN-001, record the candidate link, start and end times, final status failed, and the log path. Do not create a completed estimate record merely because a log contains intermediate values. If the run did return an explicitly identified preliminary estimate, record it only with a clear estimate state that distinguishes it from the completed result; otherwise, record no estimate row. RUN-003 gets its own start and end times, status, log, and any estimates or output files it returns.

The time arithmetic is consistent: RUN-001 lasted \(09{:}12-09{:}00=12\) minutes, and RUN-003 lasted \(09{:}44-09{:}30=14\) minutes. Those durations describe execution time, not model quality. Keeping both runs means that a reviewer can distinguish a failed attempt from the subsequent completion instead of seeing a misleading record in which RUN-001 appears to have succeeded.

Link Estimates and Files Without Losing Context

A parameter estimate is meaningful only with its parameter name, the run that returned it, and its interpretation. Store the value with units where units apply and state its scale or parameterization where that affects interpretation. For example, a clearance estimate reported in litres per hour is not interchangeable as a displayed value with a log-clearance estimate. Preserve enough context to tell which was recorded. If an estimate is unavailable, do not substitute zero: zero is a numerical value, not a missing-result code.

Artifacts should be recorded as separate entries when a run has multiple files. A useful artifact record identifies the run, the file’s role (for example, estimation log or parameter table), and its location. A file name alone may not identify a file uniquely, particularly if different run folders reuse the same name. Use a location that resolves unambiguously within the analysis environment and retain a clear indication if a file is missing or no longer available. A registry entry points to a file; it does not guarantee that the file is intact or that its contents are correct.

Worked Example: Linking Estimates and Output Files

Suppose hypothetical RUN-003 returns estimates for clearance and volume. The output reports clearance as \(5.20\) L/h and volume as \(42.0\) L. Its run directory contains a completed parameter table and an estimation log.

Create two estimate records, both linked to RUN-003: (1) parameter clearance, value \(5.20\), units L/h; and (2) parameter volume, value \(42.0\), units L. Create two artifact records linked to RUN-003: one for the parameter table and one for the estimation log, each with its role and unambiguous location. There are two estimates and two artifacts, but only one run; storing each value and file separately does not create additional executions.

If the log is later absent but the parameter table remains, update the artifact availability for the log or record that it cannot be found, according to the registry’s policy. Do not silently point the log entry at the parameter table, because that would make the file’s declared role false.

Build and Check the Registry as a Linked System

The registry is reliable only if its links and status rules are coherent. A small set of checks can catch structural problems before the records are used to summarize model-development work. These checks concern the registry’s organization; they do not establish that the model has converged or that its estimates are appropriate.

1
Create the candidate record.
Assign a unique candidate ID and record the specification and configuration references that define the candidate.
2
Create a run record for every attempt.
Assign a new run ID, link it to one existing candidate, and record its initial status and execution details.
3
Update status and attach returned records.
Record the run’s outcome, then link available estimates, logs, and other output files to that run.
4
Check links and completeness.
Confirm that IDs are unique, every run references a candidate, and each estimate and artifact references a valid run. Check that the status agrees with the records claimed to be complete.

The logic for separating candidate and run IDs is straightforward. If the candidate itself is the only identifier, a retry must either reuse the same record and overwrite its outcome, or create a second candidate even though the intended configuration is unchanged. The first choice erases an execution attempt; the second confuses a model specification with an execution. With separate IDs, the candidate remains one specification and each attempt is separately identifiable. This is why the candidate-to-run relationship is one-to-many, while each run refers to one candidate.

Diagnostics, Alternatives, and Limits

Common warning signs include duplicate IDs, runs with no candidate link, estimates with no run link, output paths that do not resolve, and records marked succeeded despite having no expected completion output. Such findings call for resolving or flagging the inconsistency, not guessing which record was intended. A missing log should be recorded as missing; it should not be treated as evidence that the execution succeeded or failed. Similarly, a successful execution status is not a substitute for reviewing estimation output.

A spreadsheet is an accessible alternative to a database and can work for a small registry if identifiers, allowed statuses, and linked tables are maintained consistently. A database can enforce uniqueness and link constraints more directly, which is useful as the number of records or contributors grows. A collection of filenames and folders alone is weaker: filenames can be changed or reused, and they do not inherently record status transitions or connect estimates to a candidate. Whichever storage format is chosen, the same concepts—separate records, stable IDs, explicit links, and defined statuses—are needed.

A registry also has limits. It can show what was recorded and where files were expected to be; it cannot prove that a configuration reference was implemented correctly, that an output file is valid, or that a fitting procedure met its scientific objectives. Those require checks beyond registry structure. The registry is a traceable index for model-development work, not a certificate of model validity.

Common Mistakes

  • Reusing a run ID for a retry. This overwrites or blurs execution history. Assign a new run ID for every attempt and link it to the same candidate when appropriate.
  • Using the model label as the only identifier. Labels can be edited or repeated. Keep a stable candidate ID and store the label as a description.
  • Recording only a final status. This may conceal whether an attempt was retried or how it ended. Preserve relevant status events or, at minimum, retain each attempt as its own run record.
  • Treating “succeeded” as “acceptable.” Execution completion is a computational status, not a scientific conclusion about fit quality.
  • Saving estimates without units or run links. A bare number can be misinterpreted or assigned to the wrong attempt. Record its parameter, interpretation, and run ID.
Key takeaway: Maintain separate, stable identifiers for candidate specifications and execution attempts. Link every run to one candidate, and link estimates, logs, and output files to the run that produced them. Keep execution status distinct from scientific interpretation.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A candidate is fitted twice, and its first attempt fails. How many candidate records and run records should the registry contain?
  2. Why should a descriptive candidate label not be the only identifier?
  3. A run is marked succeeded, but its expected parameter table is absent. What should be done in the registry, and what does the status alone establish?
  4. A clearance estimate is recorded as 4.8 with no units and no run ID. Name two pieces of context needed to make the entry interpretable and traceable.
  5. Can two files with the same filename be unambiguously linked to different runs by filename alone? Explain.

Solutions. (1) One candidate record and two run records: both attempts refer to the same specification, but they are distinct executions. (2) A label can change or be reused, so it does not reliably identify one candidate; use a stable unique ID and keep the label as a description. (3) Record the missing expected artifact or resolve the inconsistency under the registry policy. “Succeeded” records the defined execution outcome; by itself it does not establish that the expected file exists or that the fit is scientifically acceptable. (4) Record the clearance units, such as L/h if that is the reported unit, and the run ID; the parameterization or scale may also be needed. (5) No. A filename alone can be reused. Record each artifact’s run link and an unambiguous path or location.