@@ -118,3 +118,63 @@ async def test_database_isolation__2(aidbox_client, safe_db):
118118
119119 patients = await aidbox_client .resources ("Patient" ).fetch_all ()
120120 assert len (patients ) == 4
121+
122+
123+ @pytest .mark .asyncio ()
124+ async def test_database_isolation_with_history_in_name__1 (aidbox_client , safe_db ):
125+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
126+ assert len (resources ) == 0
127+
128+ resource = aidbox_client .resource (
129+ "FamilyMemberHistory" ,
130+ status = "completed" ,
131+ patient = {
132+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-1" }
133+ },
134+ relationship = {
135+ "coding" : [
136+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "FTH" }
137+ ]
138+ },
139+ )
140+ await resource .save ()
141+
142+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
143+ assert len (resources ) == 1
144+
145+
146+ @pytest .mark .asyncio ()
147+ async def test_database_isolation_with_history_in_name__2 (aidbox_client , safe_db ):
148+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
149+ assert len (resources ) == 0
150+
151+ resource1 = aidbox_client .resource (
152+ "FamilyMemberHistory" ,
153+ status = "completed" ,
154+ patient = {
155+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-1" }
156+ },
157+ relationship = {
158+ "coding" : [
159+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "FTH" }
160+ ]
161+ },
162+ )
163+ await resource1 .save ()
164+
165+ resource2 = aidbox_client .resource (
166+ "FamilyMemberHistory" ,
167+ status = "completed" ,
168+ patient = {
169+ "identifier" : {"system" : "http://example.org/test-patients" , "value" : "test-patient-2" }
170+ },
171+ relationship = {
172+ "coding" : [
173+ {"system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode" , "code" : "MTH" }
174+ ]
175+ },
176+ )
177+ await resource2 .save ()
178+
179+ resources = await aidbox_client .resources ("FamilyMemberHistory" ).fetch_all ()
180+ assert len (resources ) == 2
0 commit comments