Skip to content

Commit

Permalink
Merge pull request #140 from mdsol/fix/deployment_fix_runs_on
Browse files Browse the repository at this point in the history
Add missing FormData attributes
  • Loading branch information
glow-mdsol authored Nov 6, 2023
2 parents f3ee0f6 + b91c87f commit 192d333
Show file tree
Hide file tree
Showing 6 changed files with 597 additions and 520 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
test-publish:
name: Test Publish
runs-on:
ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -32,6 +34,8 @@ jobs:
publish:
needs: test-publish
name: Publish to PyPI
runs-on:
ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down
1,085 changes: 567 additions & 518 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ requests = "*"
six = "*"
click = "*"
faker = "*"
urllib3 = "^1.26.9"
urllib3 = "*"
Sphinx = { version = "^5.1.1", optional = true }


Expand Down
12 changes: 11 additions & 1 deletion rwslib/builders/clinicaldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,19 @@ class FormData(TransactionalElement, LastUpdateMixin, MilestoneMixin):

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

def __init__(self, formoid, transaction_type=None, form_repeat_key=None):
def __init__(self, formoid, transaction_type=None, form_repeat_key=None, lab_reference=None, lab_type=None):
"""
:param str formoid: :class:`FormDef` OID
:param str transaction_type: Transaction Type for Data (one of **Insert**, **Update**, **Upsert**, **Context**, **Remove**)
:param str form_repeat_key: Repeat Key for FormData
:param str lab_reference: Name for the Lab with the ranges
:param LabType lab_type: Type of the Lab (Central, Local)
"""
super(FormData, self).__init__(transaction_type)
self.formoid = formoid
self.form_repeat_key = form_repeat_key
self.lab_reference = lab_reference
self.lab_type = lab_type
self.itemgroups = []
#: :class:`Signature` for FormData
self.signature = None # type: Signature
Expand All @@ -254,6 +258,12 @@ def build(self, builder):
if self.form_repeat_key is not None:
params["FormRepeatKey"] = str(self.form_repeat_key)

if self.lab_reference is not None:
params["mdsol:LaboratoryRef"] = str(self.lab_reference)

if self.lab_type is not None:
params["mdsol:LaboratoryType"] = self.lab_type.value

# mixins
self.mixin()
self.mixin_params(params)
Expand Down
9 changes: 9 additions & 0 deletions rwslib/builders/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,15 @@ class LocationType(enum.Enum):
Other = 'Other'


class LabType(enum.Enum):
"""
Type of LaboratoryType
Applies to a :class:`FormData`
"""
Local = 'Local'
Central = 'Central'


class UserType(enum.Enum):
"""
User Type Enumeration
Expand Down
5 changes: 5 additions & 0 deletions rwslib/tests/test_builders_clinicaldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ def test_add_signature(self):
self.assertEqual(self.__class__.__name__[4:], t.tag)
self.assertTrue(len(list(t)) == 4) # three igdata + 1 signature

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

class TestItemGroupData(unittest.TestCase):
"""Test ItemGroupData classes"""
Expand Down

0 comments on commit 192d333

Please sign in to comment.