Documentation · Working document

Digital Twin Backend Architecture

Document-driven requirements, biological context, consent, longitudinal evidence and implementation boundaries.

About this file

Kind of file
Markdown text
Status
Working document
Dated
5 September 2026
Size
14 KB
File
VERA_DIGITAL_TWIN_ARCHITECTURE.md
Fingerprint (SHA-256)
21e3e7c28f6e8401a8b3ee81e39b8d266c674d60320ba7b51de5cd930e257620

This page is drawn from the file itself each time it opens, so it always shows what the download holds.

Test names, file names and code are quoted as the code writes them, so some keep American spelling.

VERA Digital Twin Backend Architecture

Version 1.1 | 5 September 2026 | Engineering requirements and implementation record

1 The operating model

PREPAIRE structures human biological evidence so that the Digital Twin can use it responsibly over time. VERA acquires and normalises evidence; the private knowledge graph connects released facts; qualified analytical models may interpret those facts; the patient interface explains the evidence and its limitations. These are separate services with explicit contracts, not a single neural network that turns every upload into a clinical conclusion.

The supplied mission and product documents establish the intended direction. They are not evidence that a particular diagnostic model, commercial relationship, instrument export or clinical outcome has been validated. The current implementation strengthens the evidence and access boundaries. It does not claim a working model federation, a clinical inference engine or a connected laboratory installation.

2 What the documents change

NEWGenetiq, pages 7 and 16 to 17, requires evidence to retain its origin, date, specimen, method, context and allowed use. The implemented biological-context sidecar records these details alongside the original L0 and fact schemas. A source checksum and page or record anchor connect a receipt to the original artefact. Method and policy versions are explicit; preanalytical metadata is preserved. The sidecar's policy and source hashes must reconcile to L0 provenance before release. It does not replace the native vault or the original report's standard ranges.

NEWGenetiq distinguishes Passport, Check and AXIOM under one identity. The existing product field is retained rather than creating separate patient identities. Historical Passport evidence cannot become a current-state or personal-baseline measurement merely because it was recently uploaded. The currently implemented operational release path is AXIOM. Passport report extraction and the Check intake workflow still need dedicated qualified adapters; a schema enum is not a shipped workflow.

Our Mission and The Prepaire Bible describe observation, interpretation, experimental validation and learning as a continuing cycle. Code now explicitly separates measured and derived measurements from self-reports and model inferences. Clock ages and polygenic scores require inference provenance. A model inference carries its model digest, weights hash, input fact references, validation evidence hash, uncertainty and limitations. These are admission requirements and reviewer attestations, not automatic proof of model validity.

Letter to team requires method bridging and privacy-preserving learning. The longitudinal API groups numerical measurements only when their assay, specimen type, source type, platform, analytical versions, parameters, references, units, evidence class and fasting context match. It does not pool different methods or merge discordant callers into one value. Medication and other confounders remain visible for downstream review; matching fingerprints alone does not establish complete biological comparability. A real bridge still requires a paired-specimen study and a separately approved transform.

The PLAN and Dubai network documents require accountable local operations and patient control. The twin API now requires matching signed node and jurisdiction claims, a current subject-recipient access directive, and an allowed product and purpose. The latest directive controls access. Expired or revoked access does not fall back to an older grant. Care-related purposes and optional research can be granted separately; refusing research does not disable history access.

The Biology Intelligence API pack separates local raw evidence from reference intelligence and model learning. This revision provides a private evidence pull interface and explicitly does not authorise model training or external-model export. It does not implement a corporate intelligence API, cross-border transport, model-delta aggregation or token minting. Network egress policy, receiving-service access controls and contractual rights remain necessary; a JSON permission flag cannot constrain a malicious recipient by itself.

3 Evidence use is not clinical authority

Each record declares permitted uses: history, trend, current_state, personal_baseline and research. Current-state use requires an explicit policy expiry; there is no universal freshness period. A dated result may remain useful as history after it is no longer eligible to describe the present. The policy comes from an approved assay-specific rule set, not an arbitrary application default.

The service intersects evidence eligibility with the current recipient directive and release conditions. An eligible personal_baseline input is not a computed personal range. At least two distinct eligible specimens collected at distinct times can produce COMPARABLE_MEASUREMENTS in the receipt API. That status means a candidate measurement series, not a healthy range, statistical sufficiency or a clinical treatment target. Both personalizedReferenceRange and homeostaticTarget remain null.

Model estimates and self-reports never enter the numerical measurement series. Experimental results must retain their source and specimen type and cannot be represented as measurements made on a patient. The current schemas support such distinctions, but laboratory and clinical reviewers must validate classification and model applicability. No generated organ illustration constitutes imaging evidence. No cross-axis association is labelled causal merely because several omics layers support it.

The four AXIOM research axes in the Bible, immune senescence, organ age, epigenetic velocity and mitochondrial or metabolic flux, organise scientific development. The backend does not manufacture four scores or a percentage of the body understood. Any future score requires a defined endpoint, model contract, uncertainty, validation cohort and prospective intended-use review.

4 New backend interfaces

POST /api/v1/twin-access-decisions appends a privacy officer's reviewed directive. The request binds a pseudonymous subject to an OIDC recipient subject, product scopes, purposes, expiry, evidence URI and checksum. The officer cannot alter their own recipient access. A node-scoped database lock and previousDecisionId prevent concurrent updates from silently replacing one another. Every decision is append-only and audited. The source consent ceremony is not performed by this endpoint; the officer must inspect and retain the underlying evidence. Keep the returned decisionId in the authorised consent service for future updates.

GET /api/v1/releases/{releaseId}/facts checks recipient authorisation before reading private object bytes, verifies immutable custody and the typed package, and checks release and directive state again before returning. It requires kg_service, qa_officer or lab_director plus matching signed vera_node_id and vera_jurisdiction. Authorisation roles alone do not grant patient access. The receiver must enforce the same purpose and invalidate superseded or revoked evidence it has already consumed. The producer's recheck cannot recall bytes already transmitted.

POST /api/v1/twin-evidence/assemble accepts one to twenty release identities for history use. It returns selected evidence, not the participant's complete record. It rejects mixed participants, mixed node scopes, duplicate facts and ineligible releases. Requests are limited to 64 KiB, combined artefact payloads to 64 MiB and facts to 20,000. Every receipt includes specimen and collection time, result and unit, evidence class, source anchor, method, preanalytics, policy, inference lineage when present, reviewer, consent decision and eligibility blockers.

The response deliberately contains no automated diagnosis, action offer, prescription, organ-health image or model-weight update. Downstream qualified services can consume the evidence under separate authorisation. Research access is not a training licence. The purpose vocabulary intentionally has no model_training permission.

5 Developer connection sequence

Deploy the two new migrations using the controlled migration credential. They add immutable pipeline resource definitions and an append-only TwinAccessDecision ledger. Existing release artefacts are never edited in place. A legacy typed artefact lacking reviewed biological context must be reissued through the normal lineage and review process. This is an intentional fail-closed compatibility boundary.

Configure VERA_NODE_ID and VERA_JURISDICTION and issue matching signed OIDC claims to explicitly authorised principals. Add privacy_officer to the identity provider's permitted roles. Do not accept node identity from unsigned request headers. Use distinct identities for scientific submission, release review, privacy approval and KG consumption. The new node and consent policy applies to typed release and twin retrieval routes; it is not a retrofit of row-level tenant isolation across every legacy operator API. Use separate node deployments until that wider audit is complete.

Prepare a reviewed biological-context.json sidecar and pass it to analysis:normalize with --biological-context. Include its source, policy and preanalytics hashes in the appropriate L0 provenance fields. Upload the final package through the existing custody flow, complete independent release review, then record the permitted recipient directive. Fetch released facts or assemble history using the authorised service identity. Retain release, artefact and directive identifiers in the receiver's ledger.

The application, worker, registry seeder and database-control script now share a Prisma PostgreSQL driver adapter. The installed Prisma 7 client requires this adapter; construction without it failed before a database connection could be made. The adapter uses a bounded pool, a five-second connection timeout and an explicitly selected schema without disabling TLS verification. Configure production connection and certificate settings through the deployment secret manager.

Run an isolated non-patient integration test covering grant, successful retrieval, consent revocation, expired grant, release revocation during retrieval, cross-node access, wrong recipient and exact replay. Unit tests exercise these policy boundaries with controlled fixtures; they do not establish live identity-provider or database behaviour. Apply and test append-only database triggers before accepting patient evidence.

6 Scientific and product boundaries

The latest Cohort50 direction is One World with twelve main communities and overlapping subgroups, not the older 25,000 Emirati and 25,000 expatriate split in earlier launch material. Ethnicity, ancestry, nationality, clinical phenotype and collection site remain distinct analytical dimensions. Recruitment membership cannot become a biological standard range or a claim of global representativeness. No recruitment quotas or ancestry-derived clinical cutoffs were hardcoded in this revision.

Replacing third-party software is a per-assay qualification decision. Neither 11,000 nor 50,000 participants automatically triggers decoupling. Independent truth, controlled holdouts, local controls, subgroup performance, licensing and a reviewed rollback plan remain required. Fresh patient evidence does not automatically become training data. The baseline engine remains available while an in-house candidate is validated in shadow mode.

Future work is explicit: qualified Passport and Check adapters; ontology membership and crosswalk validation; a consent-aware Gauss receiver with acknowledgement and invalidation; validated method bridges; clinically qualified longitudinal models; prospective adherence and outcome evaluation; and separately governed federated aggregates, model deltas and knowledge assertions. Public reference nodes and patient evidence must never be merged indiscriminately. Wet-lab experimental evidence can inform a hypothesis without becoming proof of clinical benefit.

7 Source record

The review covered all pages or paragraphs of NEWGenetiq.pdf, PLAN-deck.pdf, Our Mission.docx, The_Prepaire_Bible_edited_V2.pdf, Dubai Longevity Diagnostic Network.pdf, Dubai 20th June 2026 2.pdf, Prepaire Biology Intelligence Api - Open Ai Partnership Pack copy.pdf, Keynote2.docx, PrepaireSummary.pdf, Letter to team.pdf and Pitch.docx. Image-only material in the network and summary decks was read through local OCR. The Cohort50 video was reviewed through visual frames sampled every ten seconds; its audio was not transcribed or reviewed. Source files remain outside the application public directory.

Commercial pricing, financial plans, proposed partnerships and illustrative clinical screenshots were not converted into system facts, credentials, patient results or medical rules. The source set informs product direction; implementation and validation status are established separately by the code and verification record.

Interoperability references are HL7 FHIR Observation, Provenance and Consent. VERA's current custom JSON contracts are not a claim of FHIR conformance. PostgreSQL integration follows Prisma driver adapter guidance.

Implementation entrypoints are src/lib/biological-context.ts, src/lib/typed-evidence.ts, src/lib/twin-access-policy.ts, src/lib/released-twin-evidence.ts, src/lib/twin-evidence.ts and src/lib/prisma-client.ts. Generated schemas and the OpenAPI supplement accompany these modules. The verification record distinguishes executed local checks from remaining laboratory and infrastructure acceptance tests.

Demonstration copy