Ignixa.FhirFakes
0.0.127
dotnet add package Ignixa.FhirFakes --version 0.0.127
NuGet\Install-Package Ignixa.FhirFakes -Version 0.0.127
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ignixa.FhirFakes" Version="0.0.127" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ignixa.FhirFakes" Version="0.0.127" />
<PackageReference Include="Ignixa.FhirFakes" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ignixa.FhirFakes --version 0.0.127
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ignixa.FhirFakes, 0.0.127"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ignixa.FhirFakes@0.0.127
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ignixa.FhirFakes&version=0.0.127
#tool nuget:?package=Ignixa.FhirFakes&version=0.0.127
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ignixa.FhirFakes
A comprehensive FHIR test data generation library for modeling patient populations and medical histories.
Installation
dotnet add package Ignixa.FhirFakes
Quick Start
Generate a Single Patient with Full Lifecycle
using Ignixa.FhirFakes.Lifecycle;
using Ignixa.Specification.Generated;
// Create schema provider
var schemaProvider = new R4CoreSchemaProvider();
// Generate a 50-year-old with metabolic syndrome progression
var context = LifecycleExampleScenarios.GetMetabolicSyndromeLifecycle(schemaProvider);
// Access generated resources
Console.WriteLine($"Patient: {context.Patient.Id}");
Console.WriteLine($"Conditions: {context.Conditions.Count}"); // 2-4 chronic conditions
Console.WriteLine($"Medications: {context.Medications.Count}"); // 3-6 medications
Console.WriteLine($"Encounters: {context.Encounters.Count}"); // 40-45 visits over 50 years
Console.WriteLine($"Observations: {context.Observations.Count}"); // 150+ vitals and labs
Generate a Population from a State
using Ignixa.FhirFakes.Population;
using Ignixa.Specification.Generated;
var schemaProvider = new R4CoreSchemaProvider();
var generator = new PopulationGenerator(schemaProvider);
// Generate 100 patients with Massachusetts demographics
// Note: First parameter is state name, not city name
var patients = generator.Generate("Massachusetts", 100);
// Result: 100 patients with:
// - Names: Culturally appropriate (Bogus locales)
// - Ages: Sampled from Boston age distribution
// - Race: 53% White, 25% Black, 19% Hispanic, 9% Asian
// - Zip Codes: 02101-02199 (Boston area)
// - Phone Numbers: 617-xxx-xxxx or 857-xxx-xxxx
// - Full medical history: birth to current age with realistic disease onset
Discover Available Cities with KnownCities
using Ignixa.FhirFakes.Population;
// Strongly-typed access with IntelliSense
var boston = KnownCities.Boston;
var seattle = KnownCities.Seattle;
var allCities = KnownCities.All; // All 11 cities
// Inspect city demographics
Console.WriteLine($"City: {boston.Name}, {boston.State}");
Console.WriteLine($"Population: {boston.Population:N0}");
Console.WriteLine($"Race Distribution: {boston.RaceDistribution["White"]:P0} White");
Console.WriteLine($"Zip Codes: {boston.ZipCodePrefix}xx");
Console.WriteLine($"Area Codes: {string.Join(", ", boston.AreaCodes)}");
Create Custom Scenarios with Probabilistic Branching
using Ignixa.FhirFakes.Scenarios;
using Ignixa.FhirFakes.Scenarios.States;
var builder = new ScenarioBuilder(schemaProvider)
// Simple patient with basic demographics
.WithPatient(p => p.WithAge(55).WithGender(g => g.Male))
// Or use realistic patient from specific city (ethnically appropriate names, real demographics)
// .WithPatient(p => p.FromCity(KnownCities.Boston).WithAge(55).WithGender(g => g.Male))
.AddEncounter("Annual wellness visit")
// Use reusable fragments
.AddSubScenario(CommonScenarios.RecordVitalSigns(), "Vitals")
.AddSubScenario(CommonScenarios.LipidPanel(), "Cholesterol Screening")
// Probabilistic disease onset (15% chance of elevated cholesterol)
.AddProbabilisticBranch(
0.15,
// TRUE PATH: Elevated cholesterol - prescribe statin
new ConditionOnsetState
{
Code = FhirCode.Conditions.Hyperlipidemia,
Severity = 2
}
.ThenAddMedicationOrder(MedicationOrderState.Atorvastatin20mg())
.ThenDelay(TimeSpan.FromDays(90))
.ThenAddEncounter("Lipid panel follow-up"),
// FALSE PATH: Normal screening (85%)
new DelayState { Exact = TimeSpan.Zero }
);
var context = builder.Build();
Architecture
Layer 1: Random Resources
BindingAwareGenerator: Core resource generation- Respects FHIR profiles and terminology bindings
- Generates valid references and complex types
Layer 2: Clinical Scenarios
ScenarioBuilder: Fluent composition APIProbabilisticBranchState: Evidence-based branchingVitalSignCorrelationEngine: Physiological realismCommonScenarios: Reusable clinical fragments
Layer 3: Patient Lifecycles
LifecycleSimulator: Age-based event schedulingDiseaseRiskCalculator: Evidence-based risk modelingLifecycleExampleScenarios: Pre-built patient archetypes:- Healthy child (0-18 years)
- Typical adult (0-45 years)
- Metabolic syndrome (0-50 years)
- Pediatric asthma (0-10 years)
- Elderly multi-morbidity (0-80 years)
Layer 4: Population Generation
PopulationGenerator: Large-scale cohort creationCityDemographics: US Census-based distributionsKnownCities: 11 major US cities with real demographicsEthnicNameGenerator: Culturally appropriate names via Bogus locales
Dependencies:
Ignixa.Specification(FHIR schema provider)Ignixa.Serialization(FHIR serialization)Bogus(name and data generation)
Inspiration and Complementary Tools
This library was inspired by Synthea, the well-established synthetic patient generator developed by The MITRE Corporation. Synthea is a mature, comprehensive tool that has been instrumental in advancing healthcare interoperability and providing high-quality synthetic data to the community.
License
See LICENSE file in repository root.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Bogus (>= 35.6.5)
- Ignixa.Serialization (>= 0.0.127)
- Ignixa.Specification (>= 0.0.127)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.