Skip to content

DEPENDENCY_AND_PARITY_CATALOG.md: Phase 0 Ecosystem Mapping & Test Parity Baseline ​

NOTE

Historical record (Phase 0 discovery, September 2026). It describes the system as it was then. Neo4j, listed here as the designer's store, is retired (ADR-2245); protocol versions become immutable PostgreSQL snapshots in the kernel. Current system: ARCHITECTURE.md.

Project: Cadence Clinical Research Software Platform Target Runtime: .NET 10 (C# 14 / ASP.NET Core 10 Minimal APIs) Governing ADRs: ADR-2233, ADR-2428Regulatory Standards: 21 CFR Part 11, ICH GCP E6(R2), PRD-SYS-053


1. Dependency Cross-Walk & Ecosystem Mapping ​

This mapping cross-walk translates every Python library dependency across pyproject.toml and workspace packages into high-performance, Native AOT-ready .NET 10 equivalents managed via Central Package Management (CPM) in Directory.Packages.props.

Python 3.14+ DependencyTarget .NET 10 / C# 14 PackageArchitecture Role & Modernization Rationale
fastapi (0.141.0)Microsoft.AspNetCore.App (Minimal APIs)Direct endpoint mapping (app.MapGroup()) with zero reflection overhead, TypedResults.Ok<T>(), and IEndpointFilter for cross-cutting GxP security.
uvicorn[standard] (0.52.0)Kestrel HTTP Server (Native in ASP.NET Core 10)Ultra-high throughput HTTP/1.1, HTTP/2, and HTTP/3 server with Native AOT support, pooling, and socket optimizations.
pydantic (2.6.0+) / pydantic-coreC# 14 record types + FluentValidation (11.11.0)Immutable records with primary constructors; compile-time validation via FluentValidation; zero runtime dictionary reflection.
sqlalchemy (2.0.28+) / sqlmodelMicrosoft.EntityFrameworkCore (10.0.0-preview)Entity Framework Core 10 with Fluent API configuration (IEntityTypeConfiguration<T>), compiled queries, and .AsNoTracking().
asyncpg (0.29.0)Npgsql.EntityFrameworkCore.PostgreSQL (10.0.0-preview)High-performance ADO.NET / EF Core PostgreSQL driver supporting JSONB, connection pooling, and binary streaming.
neo4j (5.18.0)Neo4j.Driver (5.28.1)Official async .NET driver with reactive session pooling for USDM protocol graph queries.
redis (5.0.0+)StackExchange.Redis / Microsoft.Extensions.Caching.StackExchangeRedisThread-safe multiplexed Redis client for distributed 60s step-up signature replay prevention and cache invalidation.
python-jose[cryptography] / ecdsaSystem.IdentityModel.Tokens.Jwt (8.6.0) + Microsoft.IdentityModel.TokensHigh-throughput, FIPS-compliant JWT validation, RS256 token verification, RSA-PSS signatures, and SHA-256 HMAC operations.
usdm (0.65.0)Cadence.Core.Domain (USDM v3/v4 models)Strongly-typed C# 14 USDM class hierarchy with source-generated JSON converters for CDISC protocol metadata.
defusedxml (0.7.1)System.Xml (XmlReaderSettings)Native XML parser with DtdProcessing.Prohibit and XmlResolver = null to permanently prevent XXE injection vulnerabilities in CDISC ODM/XML and E2B(R3).
jinja2 (3.1.6)Fluid.Core (2.11.0) or ScribanFast, sandboxed liquid-syntax template engine for clinical email alerts, ICF generation, and narrative formatting.
python-multipartASP.NET Core Form Reader (IFormFile)Native multipart streaming with memory limits for clinical trial artifact uploads.
PyMuPDF (1.24.0) / weasyprintQuestPDF / PuppeteerSharpFluent C# layout engine generating pixel-perfect, deterministic PDF/A documents for regulatory archival and eConsent.
python-docx / docxtplDocumentFormat.OpenXml (3.2.0)Official Microsoft OpenXML SDK for generating validated protocol synopsis and clinical study report Word documents.
aioboto3 / boto3AWSSDK.S3 (3.7+)AWS SDK for .NET with async presigned URL generation, multipart uploads, and MinIO compatibility.
aiosmtplib (3.0.1)MailKit (4.9.0) + MimeKit (4.9.0)High-performance RFC-compliant MIME and SMTP client supporting STARTTLS and DKIM signing.
alembic (1.13.0)Microsoft.EntityFrameworkCore.Design (dotnet ef migrations)Audited, idempotent schema migrations generated via powershell .\scripts\manage_migrations.ps1 with Part 11 change tracking.
rapidfuzz (3.14.5)FuzzySharp (2.0.2)Fast Levenshtein and token-sort string matching for medical dictionary coding (MedDRA / WHODrug).
typer (0.12.0) / rich (13.7.0)Spectre.Console (0.49.1) + Spectre.Console.CliRich, interactive developer CLI with formatted tables, progress spinners, and interactive wizards (dotnet cadence).
litellm (1.97.0)Microsoft.Extensions.AI / SemanticKernelMicrosoft AI abstractions providing multi-provider routing (OpenAI, Gemini, Azure) with token tracking and air-gap proxies.
pydicom (3.0.2)fo-dicom (Fellow Oak DICOM 5.1.0)Native DICOM reader, de-identifier, and MPR pixel pipeline for blinded imaging adjudication.
jsonschema (4.20.0)JsonSchema.Net (7.2.0)High-performance JSON schema compilation and validation for eCRF dynamic form structures.
Asynchronous Queues & OutboxMassTransit (8.3.6) + MassTransit.EntityFrameworkCoreProduction-grade messaging bus with PostgreSQL Transactional Outbox, circuit breakers, and dead-letter queues.
Background SchedulingMicrosoft.Extensions.Hosting.BackgroundService + System.Threading.ChannelsHigh-throughput, bounded in-process asynchronous queues for anomaly detection and Merkle block sealing.
ObservabilityOpenTelemetry.Extensions.Hosting (1.11.1) + PrometheusOpenTelemetry standard for traces, metrics (System.Diagnostics.Metrics), and structured logging.
Resilience & RetriesPolly (8.5.2) + Microsoft.Extensions.Http.PollyReactive fault handling: exponential backoff, jitter, circuit breakers, and bulkhead isolation for typed HTTP clients.
Gateway Reverse ProxyYarp.ReverseProxy (2.2.0)High-performance Strangler Fig dynamic reverse-proxy routing and downstream /openapi.json schema aggregation (ADR-2239).
Video TranscodingFFMpegCore (5.1.0)Asynchronous, strongly-typed .NET wrapper for FFmpeg HLS/DASH video encoding pipelines.
Anti-Malware ScanningnClam (7.0.0)Asynchronous ClamAV client communicating with clamd daemon over TCP/Unix sockets for uploaded eTMF/fileshare attachments.
Cloud Storage & Golden Path UploadsAWSSDK.S3 (3.7+)Multi-backend storage provider implementing StoragePort (S3, MinIO, filesystem) with SHA-256 checked reads; recording evidence uses it too (ADR-2505).
Unit Testingxunit.v3 (1.1.0) + FluentAssertions (8.0.1)Fast, parallel async test execution with expressive assertion syntax.
Mocking & Test FakesNSubstitute (5.3.0) + Cadence.Testing.FakesStrongly-typed interface mocking and in-memory transactional repository doubles.
Integration TestingTestcontainers.PostgreSql + Testcontainers.Neo4j (4.3.0)Hermetic Docker container lifecycle management for isolated PostgreSQL and Neo4j integration tests.
Architecture SentinelsArchUnitNET.xUnit (0.11.1)Automated compile/test gates verifying Clean Architecture layer isolation and IGxPAuditable conformance.

2. Parity & Test Harness Harvesting ​

To guarantee 100% functional parity between Python and .NET 10 implementations under 21 CFR Part 11, all test assets and fixtures must be cataloged and transcribed into Cadence.Testing and Cadence.UnitTests.

2.1 Pytest Fixture Taxonomy & C# Equivalents ​

  1. Database Isolation & Lifecycle Fixtures (tests/conftest.py):
    • Python: create_databases_async() and drop_databases_async() dynamically create isolated PostgreSQL databases per test run (cadence_edc_{run_uid}_{worker_id}).
    • .NET Target: CadenceWebApplicationFactory<Program> initializes an isolated PostgreSQL container via Testcontainers.PostgreSql, executing EF Core migrations (db.Database.MigrateAsync()) on startup and destroying the container on dispose.
  2. Security & Cryptographic Signature Fixtures (tests/conftest.py):
    • Python: ALLOW_MOCK_SIGNATURES=1, create_test_hmac_headers(url, body, method, secret).
    • .NET Target: TestSecurityContext.CreateHmacHeaders(path, method, body, secret) located in packages/testing/src/Cadence.Testing.csproj. Generates identical canonical JSON payloads (RFC 8785) and SHA-256 hashes.
  3. In-Memory Domain Repository Fakes:
    • Python: InMemorySubjectRepository, InMemoryObservationRepository in apps/execution/tests/.
    • .NET Target: InMemoryRepository<TEntity, TId> in Cadence.Testing.Fakes implementing IRepository<TEntity, TId> with thread-safe ConcurrentDictionary storage.
  4. Asynchronous HTTP Test Clients:
    • Python: httpx.AsyncClient(transport=ASGITransport(app=app), base_url="http://test").
    • .NET Target: HttpClient created from WebApplicationFactory.CreateClient() with pre-configured gateway signature handlers.

2.2 Golden Datasets & Algorithmic Validation Vectors ​

The repository contains authoritative golden datasets used to test core clinical algorithms. Functional parity requires passing identical inputs through .NET 10 implementations and verifying exact JSON/XML output matching:

  1. CDISC USDM Protocol Structure Dataset:
    • File: tests/fixtures/sample_usdm_v3.json
    • Target Consumer: Cadence.Apps.Designer (Neo4j ingestion, SoA matrix builder, and DDF compiler).
    • Parity Test: Verify that deserializing this JSON into C# UsdmStudy records produces identical graph nodes, visit schedules, and epoch timelines.
  2. CDISC Dataset-JSON 1.0.0 Biostatistical Datasets:
    • Files: apps/execution/domain/sdtm/ (sdtm_models.py).
    • Target Consumer: Cadence.Apps.Execution biostatistical export engine.
    • Parity Test: Validate that exported SDTM DM (Demographics), VS (Vital Signs), and LB (Laboratory Tests) Dataset-JSON files match the CDISC validation rules with byte-for-byte metadata precision.
  3. ICH E2B(R3) ICSR ISO 27953-2 Safety XML Vectors:
    • Files: apps/safety/tests/ (test_safety_e2b_xml.py).
    • Target Consumer: Cadence.Apps.Safety.
    • Parity Test: Validate generated XML against the official FDA/EMA E2B(R3) schema definition using System.Xml.Schema.XmlSchemaSet.
  4. NCI-CTCAE Toxicity Grading Tables:
    • Files: apps/execution/domain/lab_assessment_models.py and apps/safety/models.py.
    • Target Consumer: Cadence.Apps.Execution and Cadence.Apps.Safety.
    • Parity Test: Ensure Grade 1 through Grade 4 adverse event toxicity thresholds for lab values (e.g. Potassium, ALT, AST, Bilirubin) evaluate to identical clinical severity grades.
  5. Flesch-Kincaid Readability & eConsent Calculation Vectors:
    • Files: apps/econsent/tests/test_readability_harmonizer.py.
    • Target Consumer: Cadence.Apps.Econsent.
    • Parity Test: Verify that syllable counting, word count, and Flesch-Kincaid Grade Level formulas produce matching floating-point scores.

2.3 Regulatory Traceability Dual-Tagging Standard (PRD-SYS-053) ​

Under 21 CFR Part 11, every test migrated from Python to .NET 10 must retain complete requirement traceability:

csharp
namespace Cadence.UnitTests.Execution;

using Xunit;
using FluentAssertions;
using Cadence.Core.Domain;
using Cadence.Apps.Execution.Domain;
using Cadence.Testing.Fakes;

public sealed class SubjectEnrollmentTests
{
    [Fact]
    [Trait("Category", "GxP_OQ")]
    [GxPRequirement("PRD-SYS-053")]
    public async Task EnrollSubject_WithValidProtocolAmendment_RecordsAuditLedger()
    {
        /// <summary>
        /// Asserts that enrolling a subject generates a 21 CFR Part 11 audit entry with cryptographic hash.
        /// @req:PRD-SYS-053
        /// </summary>

        // Arrange
        var repository = new InMemoryRepository<Subject, string>();
        var subjectResult = Subject.Register("SITE-01", "SUBJ-1001", "investigator@ccrsoft.com", "Initial Screening");

        // Act
        subjectResult.IsSuccess.Should().BeTrue();
        await repository.AddAsync(subjectResult.Value);

        // Assert
        var persisted = await repository.GetByIdAsync(subjectResult.Value.Id);
        persisted.Should().NotBeNull();
        persisted!.VersionIndex.Should().Be(1);
        persisted.CreatedBy.Should().Be("investigator@ccrsoft.com");
    }
}