Skip to content

Commit 192d333

Browse files
authored
Merge pull request #140 from mdsol/fix/deployment_fix_runs_on
Add missing FormData attributes
2 parents f3ee0f6 + b91c87f commit 192d333

File tree

6 files changed

+597
-520
lines changed

6 files changed

+597
-520
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
jobs:
88
test-publish:
99
name: Test Publish
10+
runs-on:
11+
ubuntu-latest
1012
strategy:
1113
fail-fast: false
1214
matrix:
@@ -32,6 +34,8 @@ jobs:
3234
publish:
3335
needs: test-publish
3436
name: Publish to PyPI
37+
runs-on:
38+
ubuntu-latest
3539
strategy:
3640
fail-fast: false
3741
matrix:

poetry.lock

Lines changed: 567 additions & 518 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ requests = "*"
3030
six = "*"
3131
click = "*"
3232
faker = "*"
33-
urllib3 = "^1.26.9"
33+
urllib3 = "*"
3434
Sphinx = { version = "^5.1.1", optional = true }
3535

3636

rwslib/builders/clinicaldata.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,19 @@ class FormData(TransactionalElement, LastUpdateMixin, MilestoneMixin):
225225

226226
ALLOWED_TRANSACTION_TYPES = ["Insert", "Update", "Upsert", "Context", "Remove"]
227227

228-
def __init__(self, formoid, transaction_type=None, form_repeat_key=None):
228+
def __init__(self, formoid, transaction_type=None, form_repeat_key=None, lab_reference=None, lab_type=None):
229229
"""
230230
:param str formoid: :class:`FormDef` OID
231231
:param str transaction_type: Transaction Type for Data (one of **Insert**, **Update**, **Upsert**, **Context**, **Remove**)
232232
:param str form_repeat_key: Repeat Key for FormData
233+
:param str lab_reference: Name for the Lab with the ranges
234+
:param LabType lab_type: Type of the Lab (Central, Local)
233235
"""
234236
super(FormData, self).__init__(transaction_type)
235237
self.formoid = formoid
236238
self.form_repeat_key = form_repeat_key
239+
self.lab_reference = lab_reference
240+
self.lab_type = lab_type
237241
self.itemgroups = []
238242
#: :class:`Signature` for FormData
239243
self.signature = None # type: Signature
@@ -254,6 +258,12 @@ def build(self, builder):
254258
if self.form_repeat_key is not None:
255259
params["FormRepeatKey"] = str(self.form_repeat_key)
256260

261+
if self.lab_reference is not None:
262+
params["mdsol:LaboratoryRef"] = str(self.lab_reference)
263+
264+
if self.lab_type is not None:
265+
params["mdsol:LaboratoryType"] = self.lab_type.value
266+
257267
# mixins
258268
self.mixin()
259269
self.mixin_params(params)

rwslib/builders/constants.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,15 @@ class LocationType(enum.Enum):
297297
Other = 'Other'
298298

299299

300+
class LabType(enum.Enum):
301+
"""
302+
Type of LaboratoryType
303+
Applies to a :class:`FormData`
304+
"""
305+
Local = 'Local'
306+
Central = 'Central'
307+
308+
300309
class UserType(enum.Enum):
301310
"""
302311
User Type Enumeration

rwslib/tests/test_builders_clinicaldata.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ def test_add_signature(self):
422422
self.assertEqual(self.__class__.__name__[4:], t.tag)
423423
self.assertTrue(len(list(t)) == 4) # three igdata + 1 signature
424424

425+
def test_lab_settings(self):
426+
tested = FormData("TESTFORM_A", lab_reference="A Lab", lab_type=LabType.Local)
427+
doc = obj_to_doc(tested)
428+
self.assertEqual(doc.attrib["mdsol:LaboratoryRef"], "A Lab")
429+
self.assertEqual(doc.attrib["mdsol:LaboratoryType"], "Local")
425430

426431
class TestItemGroupData(unittest.TestCase):
427432
"""Test ItemGroupData classes"""

0 commit comments

Comments
 (0)