Skip to content

Commit ba97f86

Browse files
committed
Remove fhir translations
1 parent 9c04f3e commit ba97f86

File tree

3 files changed

+3
-132
lines changed

3 files changed

+3
-132
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ boto3-stubs = { extras = [
5555
], version = "^1.34.37" }
5656
pytest-timeout = "^2.2.0"
5757
lz4 = "^4.3.3"
58-
gevent = "<24.10.2"
5958

6059
[tool.poetry.group.local]
6160
optional = true

src/layers/domain/fhir/r4/cpm_model.py

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import re
2-
from typing import Literal # , Dict, Union
2+
from typing import Literal
33
from uuid import UUID
44

55
from domain.core.device import DeviceKeyType, DeviceType
@@ -36,11 +36,6 @@ def dict(self, *args, **kwargs):
3636
return {"system": self.system, "value": str(self.value)}
3737

3838

39-
# class Link(BaseModel):
40-
# relation: str
41-
# url: str
42-
43-
4439
class OdsIdentifier(BaseModel):
4540
system: str = ConstStrField(ODS_API_BASE)
4641
value: str = Field(regex=ODS_CODE_REGEX)
@@ -122,48 +117,3 @@ def no_duplicate_product_keys(cls, identifier: list[DeviceIdentifier]):
122117
if count > 1:
123118
raise ValueError("It is forbidden to supply a product_id")
124119
return identifier
125-
126-
127-
# class Reference(BaseModel):
128-
# reference: str
129-
130-
131-
# class Answer(BaseModel):
132-
# valueString: str
133-
134-
135-
# class QuestionAndAnswer(BaseModel):
136-
# link_id: str
137-
# text: str
138-
# answer: list[Answer]
139-
140-
141-
# class QuestionnaireResponse(BaseModel):
142-
# resourceType: Literal["QuestionnaireResponse"]
143-
# status: str = ConstStrField("completed")
144-
# subject: Reference
145-
# author: Reference
146-
# item: list[QuestionAndAnswer] = Field(min_items=0)
147-
148-
149-
# class Resource(BaseModel):
150-
# fullUrl: str
151-
# resource: Device
152-
# search: Dict[str, str] = Field(default_factory=lambda: {"mode": "match"})
153-
154-
155-
# class Bundle(BaseModel):
156-
# resourceType: Literal["Bundle"]
157-
# id: str
158-
# total: int
159-
# link: list[Link]
160-
161-
162-
# class CollectionBundle(Bundle):
163-
# type: str = ConstStrField("collection")
164-
# entry: list[Union[Resource, QuestionnaireResponse]] = Field(min_items=1)
165-
166-
167-
# class SearchsetBundle(Bundle):
168-
# type: str = ConstStrField("searchset")
169-
# entry: list[CollectionBundle] = Field(min_items=0)
Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
# from typing import List
2-
# from uuid import uuid4
3-
41
from domain.core.device import Device as DomainDevice
52
from domain.core.product_team.v1 import ProductTeam
63
from domain.fhir.r4 import Device as FhirDevice
74
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
96
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 (
118
DeviceDefinitionIdentifier,
129
DeviceDefinitionReference,
1310
DeviceIdentifier,
1411
DeviceName,
1512
DeviceOwnerReference,
1613
ProductTeamIdentifier,
1714
)
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
2315
from domain.fhir_translation.parse import create_fhir_model_from_fhir_json
2416
from domain.response.validation_errors import mark_validation_errors_as_inbound
2517

@@ -62,73 +54,3 @@ def create_fhir_model_from_device(device: DomainDevice) -> CpmFhirDevice:
6254
identifier=ProductTeamIdentifier(value=device.product_team_id)
6355
),
6456
)
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

Comments
 (0)