@@ -23,3 +23,61 @@ async def test_database_isolation__2(fhir_client: AsyncFHIRClient, safe_db: Safe
2323
2424 patients = await fhir_client .resources (r4b .Patient ).fetch_all ()
2525 assert len (patients ) == 2 # noqa: PLR2004
26+
27+
28+ async def test_database_isolation_with_history_in_name__1 (aidbox_client , safe_db ):
29+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
30+ assert len (resources ) == 0
31+
32+ resource = aidbox_client .resource (
33+ "FamilyMemberHistory" ,
34+ status = "completed" ,
35+ patient = {
36+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-1" }
37+ },
38+ relationship = {
39+ "coding" : [
40+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "FTH" }
41+ ]
42+ },
43+ )
44+ await resource .save ()
45+
46+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
47+ assert len (resources ) == 1
48+
49+
50+ async def test_database_isolation_with_history_in_name__2 (aidbox_client , safe_db ):
51+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
52+ assert len (resources ) == 0
53+
54+ resource1 = aidbox_client .resource (
55+ "FamilyMemberHistory" ,
56+ status = "completed" ,
57+ patient = {
58+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-1" }
59+ },
60+ relationship = {
61+ "coding" : [
62+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "FTH" }
63+ ]
64+ },
65+ )
66+ await resource1 .save ()
67+
68+ resource2 = aidbox_client .resource (
69+ "FamilyMemberHistory" ,
70+ status = "completed" ,
71+ patient = {
72+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-2" }
73+ },
74+ relationship = {
75+ "coding" : [
76+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "MTH" }
77+ ]
78+ },
79+ )
80+ await resource2 .save ()
81+
82+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
83+ assert len (resources ) == 2
0 commit comments