|
1 | | -# from typing import List |
2 | | -# from uuid import uuid4 |
3 | | - |
4 | 1 | from domain.core.device import Device as DomainDevice |
5 | 2 | from domain.core.product_team.v1 import ProductTeam |
6 | 3 | from domain.fhir.r4 import Device as FhirDevice |
7 | 4 | from domain.fhir.r4 import StrictDevice as StrictFhirDevice |
8 | | -from domain.fhir.r4.cpm_model import SYSTEM # , Answer, CollectionBundle |
| 5 | +from domain.fhir.r4.cpm_model import SYSTEM |
9 | 6 | from domain.fhir.r4.cpm_model import Device as CpmFhirDevice |
10 | | -from domain.fhir.r4.cpm_model import ( # Link,; QuestionAndAnswer, |
| 7 | +from domain.fhir.r4.cpm_model import ( |
11 | 8 | DeviceDefinitionIdentifier, |
12 | 9 | DeviceDefinitionReference, |
13 | 10 | DeviceIdentifier, |
14 | 11 | DeviceName, |
15 | 12 | DeviceOwnerReference, |
16 | 13 | ProductTeamIdentifier, |
17 | 14 | ) |
18 | | - |
19 | | -# from domain.fhir.r4.cpm_model import ( |
20 | | -# QuestionnaireResponse as CpmFhirQuestionnaireResponse, |
21 | | -# ) |
22 | | -# from domain.fhir.r4.cpm_model import Reference, Resource, SearchsetBundle |
23 | 15 | from domain.fhir_translation.parse import create_fhir_model_from_fhir_json |
24 | 16 | from domain.response.validation_errors import mark_validation_errors_as_inbound |
25 | 17 |
|
@@ -62,73 +54,3 @@ def create_fhir_model_from_device(device: DomainDevice) -> CpmFhirDevice: |
62 | 54 | identifier=ProductTeamIdentifier(value=device.product_team_id) |
63 | 55 | ), |
64 | 56 | ) |
65 | | - |
66 | | - |
67 | | -# def create_fhir_model_from_questionnaire_response( |
68 | | -# device: DomainDevice, |
69 | | -# host, |
70 | | -# ) -> CpmFhirQuestionnaireResponse: |
71 | | -# items = [] |
72 | | -# for identifier, responses in device.questionnaire_responses.items(): |
73 | | -# for questionnaire_response in responses: |
74 | | -# for ques_res in questionnaire_response.responses: |
75 | | -# for question, answers in ques_res.items(): |
76 | | -# answer_objects = [Answer(valueString=answer) for answer in answers] |
77 | | -# question_and_answer = QuestionAndAnswer( |
78 | | -# link_id=question, text=question, answer=answer_objects |
79 | | -# ) |
80 | | -# items.append(question_and_answer) |
81 | | - |
82 | | -# return CpmFhirQuestionnaireResponse( |
83 | | -# resourceType=CpmFhirQuestionnaireResponse.__name__, |
84 | | -# # identifier="010057927542", |
85 | | -# # questionnaire="https://cpm.co.uk/Questionnaire/spine_device|v1", Doesn't exist yet |
86 | | -# subject=Reference(reference=f"https://{host}/Device/{device.id}"), |
87 | | -# # "authored": "<dateTime>", |
88 | | -# author=Reference( |
89 | | -# reference=f"https://{host}/Organization/{device.product_team_id}" |
90 | | -# ), |
91 | | -# item=items, |
92 | | -# ) |
93 | | - |
94 | | - |
95 | | -# def create_fhir_collection_bundle( |
96 | | -# device: DomainDevice, |
97 | | -# host, |
98 | | -# ) -> CollectionBundle: |
99 | | -# fhir_device = create_fhir_model_from_device(device=device) |
100 | | -# fhir_resource = Resource( |
101 | | -# fullUrl=f"https://{host}/Device/{device.id}", resource=fhir_device |
102 | | -# ) |
103 | | -# fhir_questionnaire = create_fhir_model_from_questionnaire_response( |
104 | | -# device=device, host=host |
105 | | -# ) |
106 | | -# return CollectionBundle( |
107 | | -# resourceType="Bundle", |
108 | | -# id=str(uuid4()), |
109 | | -# total=2, |
110 | | -# link=[Link(relation="self", url=f"https://{host}/Device/{device.id}")], |
111 | | -# entry=[fhir_resource, fhir_questionnaire], |
112 | | -# ) |
113 | | - |
114 | | - |
115 | | -# def create_fhir_searchset_bundle( |
116 | | -# devices: List[DomainDevice], |
117 | | -# device_type, |
118 | | -# host, |
119 | | -# ) -> SearchsetBundle: |
120 | | -# entries = [] |
121 | | -# for device in devices: |
122 | | -# entries.append(create_fhir_collection_bundle(device, host)) |
123 | | -# return SearchsetBundle( |
124 | | -# resourceType="Bundle", |
125 | | -# id=str(uuid4()), |
126 | | -# total=len(devices), |
127 | | -# link=[ |
128 | | -# Link( |
129 | | -# relation="self", |
130 | | -# url=f"https://{host}/Device?device_type={device_type.lower()}", |
131 | | -# ) |
132 | | -# ], |
133 | | -# entry=entries, |
134 | | -# ) |
0 commit comments