-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit c07aa53 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Tue Dec 12 11:56:29 2023 +0100 #-wip-samples commit 090dee9 Author: dlatikay <latikaynen@loidl-consulting.at> Date: Tue Dec 12 09:52:07 2023 +0100 # - WIP samples commit f8aa66f Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Mon Dec 11 18:12:54 2023 +0100 #-wip-samples added operation outcome and filter functions commit 4c278ab Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Nov 30 18:06:49 2023 +0100 #-wip-samples test put patient with external id commit f8814a0 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Nov 30 15:37:01 2023 +0100 #-wip-samples-ready commit 8d05f9b Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Wed Nov 29 18:35:57 2023 +0100 #-wip-samples-view order chains, etc commit ced04c4 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Tue Nov 28 17:59:27 2023 +0100 #-wip-samples-us015, 016, 019 commit 0528413 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Mon Nov 27 18:25:58 2023 +0100 #-wip-samples-completed US for actor care commit 1834a27 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Nov 23 18:38:09 2023 +0100 #-wip-samples use scaffold to connect multiple user stories commit 2e8ae75 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Tue Nov 21 15:19:38 2023 +0100 #-wip-samples fixes after rebase commit 2409e90 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Nov 16 14:17:41 2023 +0100 #-wip-samples-dispense commit 7273afb Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Wed Nov 15 17:26:34 2023 +0100 #-wip-samples RequestOrchestration with new constraints commit a42cdd3 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Tue Nov 7 17:43:11 2023 +0100 #-wip-samples added tests for operations commit 43fce47 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Wed Nov 1 13:59:15 2023 +0100 #-wip-samples-test US006 delete RequestOrchestration commit 12454bd Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Oct 26 11:49:12 2023 +0200 #-wip-samples- replaced endpoint LINCAOrder... by LINCAProposal... commit 5f92403 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Mon Oct 16 18:32:04 2023 +0200 #added DoseAndRate commit 5c3f469 Author: annemarie.goldmann <annemarie.goldmann@steszgal.at> Date: Thu Oct 12 20:38:52 2023 +0200 Samples, work in progress
- Loading branch information
dlatikay
committed
Dec 12, 2023
1 parent
7d782c5
commit dff7d24
Showing
35 changed files
with
2,886 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
Lc.Linca.Sdk.Sample/Specs/ActorCare/US000-InternalTestPutPatient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/*********************************************************************************** | ||
* Project: Linked Care AP5 | ||
* Component: LINCA FHIR SDK and Demo Client | ||
* Copyright: 2023 LOIDL Consulting & IT Services GmbH | ||
* Authors: Annemarie Goldmann, Daniel Latikaynen | ||
* Purpose: Sample code to test LINCA and template for client prototypes | ||
* Licence: BSD 3-Clause | ||
* --------------------------------------------------------------------------------- | ||
* The Linked Care project is co-funded by the Austrian FFG | ||
***********************************************************************************/ | ||
|
||
using Hl7.Fhir.Model; | ||
using Hl7.Fhir.Support; | ||
using Lc.Linca.Sdk.Client; | ||
using Lc.Linca.Sdk.Scaffolds; | ||
using System.Globalization; | ||
|
||
namespace Lc.Linca.Sdk.Specs.ActorCare; | ||
|
||
internal class US000_InternalTestPutPatient : Spec | ||
{ | ||
public const string UserStory = @" | ||
Caregivers can create patients with externally assigned ids by sending them with http put"; | ||
|
||
protected MedicationRequest medReq = new(); | ||
|
||
public US000_InternalTestPutPatient(LincaConnection conn) : base(conn) | ||
{ | ||
|
||
|
||
Steps = new Step[] | ||
{ | ||
new("Create client record with externally assigned id", CreateClientRecord), | ||
new("Update client record", UpdateClientRecord) | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// As an actor who is an order placer, | ||
/// it is necessary to ensure that all patient records | ||
/// which later occur in the order position(s), are present | ||
/// as FHIR resources on the linked care server. | ||
/// | ||
/// This is where an actual care information system | ||
/// would fetch the client data from its database, | ||
/// and convert it into a FHIR R5 resource | ||
/// </summary> | ||
private bool CreateClientRecord() | ||
{ | ||
LinkedCareSampleClient.CareInformationSystemScaffold.PseudoDatabaseRetrieve(); | ||
var client = new CareInformationSystem.Client(); | ||
var patient = new Patient | ||
{ | ||
Id = Guid.NewGuid().ToFhirId(), | ||
BirthDate = DateTime.ParseExact( | ||
client.DoB, | ||
Constants.DobFormat, | ||
CultureInfo.InvariantCulture | ||
).ToFhirDate() | ||
}; | ||
|
||
patient.Name.Add(new() | ||
{ | ||
Family = client.Lastname, | ||
Given = new[] { client.Firstname }, | ||
Text = client.Firstname + " " + client.Lastname | ||
}); | ||
|
||
patient.Identifier.Add(new Identifier( | ||
system: Constants.WellknownOidSocialInsuranceNr, | ||
value: client.SocInsNumber | ||
)); | ||
|
||
patient.Gender = AdministrativeGender.Female; | ||
(var createdPatient, var canCue, var outcome) = LincaDataExchange.CreatePatient(Connection, patient); | ||
|
||
if (canCue) | ||
{ | ||
Console.WriteLine($"Client information with external id transmitted, id {createdPatient.Id}"); | ||
|
||
LinkedCareSampleClient.CareInformationSystemScaffold.Data.ClientIdRenate = createdPatient.Id; | ||
LinkedCareSampleClient.CareInformationSystemScaffold.PseudoDatabaseStore(); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"Failed to transmit client information with external id"); | ||
} | ||
|
||
if (outcome != null) | ||
{ | ||
foreach (var item in outcome.Issue) | ||
{ | ||
Console.WriteLine($"Outcome Issue Code: '{item.Details.Coding?.FirstOrDefault()?.Code}', Text: '{item.Details.Text}'"); | ||
} | ||
} | ||
|
||
return canCue; | ||
} | ||
|
||
private bool UpdateClientRecord() | ||
{ | ||
LinkedCareSampleClient.CareInformationSystemScaffold.PseudoDatabaseRetrieve(); | ||
var client = new CareInformationSystem.Client(); | ||
var patient = new Patient | ||
{ | ||
Id = LinkedCareSampleClient.CareInformationSystemScaffold.Data.ClientIdRenate, | ||
BirthDate = DateTime.ParseExact( | ||
client.DoB, | ||
Constants.DobFormat, | ||
CultureInfo.InvariantCulture | ||
).ToFhirDate() | ||
}; | ||
|
||
patient.Name.Add(new() | ||
{ | ||
Family = client.Lastname, | ||
Given = new[] { client.Firstname }, | ||
Text = client.Firstname + " " + client.Lastname | ||
}); | ||
|
||
patient.Identifier.Add(new Identifier( | ||
system: Constants.WellknownOidSocialInsuranceNr, | ||
value: client.SocInsNumber | ||
)); | ||
|
||
patient.Gender = AdministrativeGender.Other; | ||
|
||
(var updatedPatient, var canCue, var outcome) = LincaDataExchange.CreatePatient(Connection, patient); | ||
|
||
if (canCue) | ||
{ | ||
if (updatedPatient.Id == patient.Id) | ||
{ | ||
Console.WriteLine($"Updated client, id {updatedPatient.Id}"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"Client update information for id {patient.Id} transmitted, but the server assigned the id {updatedPatient.Id}"); | ||
} | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"Failed to transmit client information"); | ||
} | ||
|
||
if (outcome != null) | ||
{ | ||
foreach (var item in outcome.Issue) | ||
{ | ||
Console.WriteLine($"Outcome Issue Code: '{item.Details.Coding?.FirstOrDefault()?.Code}', Text: '{item.Details.Text}'"); | ||
} | ||
} | ||
|
||
return canCue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.