From 3415518dcd72193a0016ba5ba5122ff84c20ab6e Mon Sep 17 00:00:00 2001 From: Matt Berg Date: Wed, 4 Jun 2025 11:23:40 -0400 Subject: [PATCH] Allow specifying patient name via CLI --- README.md | 8 ++++---- examples/create_patient.lua | 8 ++++++-- examples/create_patient_async.lua | 8 ++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ef8cbec..6c9d742 100644 --- a/README.md +++ b/README.md @@ -200,11 +200,11 @@ To add support for new FHIR backends: All examples automatically load configuration from your `.env` file. To run any example: ```bash -# Simple patient creation -lua examples/create_patient.lua +# Simple patient creation (optional first and last name) +lua examples/create_patient.lua [FirstName] [LastName] -# Async patient creation -lua examples/create_patient_async.lua +# Async patient creation (optional first and last name) +lua examples/create_patient_async.lua [FirstName] [LastName] # Find patient by ID or name lua examples/find_patient.lua f16195fd-25d0-4294-ad6f-8c1046897293 diff --git a/examples/create_patient.lua b/examples/create_patient.lua index f30bb30..b0ebf8d 100644 --- a/examples/create_patient.lua +++ b/examples/create_patient.lua @@ -2,6 +2,10 @@ local fhir = require("fhir") +-- Get optional first and last name from CLI arguments +local given_name = arg[1] or "Scottie" +local family_name = arg[2] or "Pippen" + -- Create client (automatically loads .env configuration) local client = fhir.client.new({ backend = "google_healthcare" @@ -13,8 +17,8 @@ local patient = fhir.resource:new("Patient", { name = { { use = "official", - family = "Pippen", - given = {"Scottie"} + family = family_name, + given = {given_name} } }, gender = "male", diff --git a/examples/create_patient_async.lua b/examples/create_patient_async.lua index 31dd6c9..740b630 100644 --- a/examples/create_patient_async.lua +++ b/examples/create_patient_async.lua @@ -3,6 +3,10 @@ local AsyncClient = require("fhir.async_client") local Resource = require("fhir.resource") +-- Get optional first and last name from CLI arguments +local given_name = arg[1] or "Shaka" +local family_name = arg[2] or "Zulu" + -- Create async client (automatically loads .env configuration) local client = AsyncClient.new({ backend = "google_healthcare" @@ -14,8 +18,8 @@ local patient = Resource:new("Patient", { name = { { use = "official", - family = "Zulu", - given = {"Shaka"} + family = family_name, + given = {given_name} } }, gender = "female",