Skip to content

Commit 0fee13a

Browse files
authored
Merge pull request #546 from pbs-data-solutions/prelude-xml-parser
Bump prelude-xml-parser
2 parents 0055e74 + ecabe90 commit 0fee13a

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ crate-type = ["cdylib"]
1616
[dependencies]
1717
anyhow = "1.0.99"
1818
chrono = "0.4.41"
19-
prelude-xml-parser = { version = "0.8.3", features = ["python"] }
20-
pyo3 = { version = "0.25.1", features = ["extension-module"] }
19+
prelude-xml-parser = { version = "0.9.0", features = ["python"] }
20+
pyo3 = { version = "0.26.0", features = ["extension-module"] }
2121
roxmltree = "0.20.0"
2222
serde = { version = "1.0.219", features = ["derive"] }
2323
serde-xml-rs = "0.8.1"

prelude_parser/_prelude_parser.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ class Value:
1111
by: str
1212
by_unique_id: str | None
1313
role: str
14-
when: datetime
14+
when: datetime | None
1515

1616
def to_dict(self) -> dict: ...
1717

1818
class Reason:
1919
by: str
2020
by_unique_id: str | None
2121
role: str
22-
when: datetime
22+
when: datetime | None
2323
value: str
2424

2525
def to_dict(self) -> dict: ...
@@ -41,7 +41,7 @@ class Field:
4141
name: str
4242
data_type: str | None
4343
error_code: str
44-
when_created: datetime
44+
when_created: datetime | None
4545
keep_history: bool
4646
entries: list[Entry] | None
4747
comments: list[Comment] | None
@@ -86,7 +86,7 @@ class Form:
8686
class Patient:
8787
patient_id: str
8888
unique_id: str
89-
when_created: datetime
89+
when_created: datetime | None
9090
creator: str
9191
site_name: str
9292
site_unique_id: str
@@ -100,7 +100,7 @@ class Site:
100100
unique_id: str
101101
number_of_patients: int
102102
count_of_randomized_patients: int
103-
when_created: datetime
103+
when_created: datetime | None
104104
creator: str
105105
number_of_forms: int
106106
forms: list[Form] | None

tests/test_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ def test_site_native_to_json(site_native_small_xml):
4242

4343
assert (
4444
result_json
45-
== '{"site":[{"name":"Some Site","uniqueId":"1681574834910","numberOfPatients":4,"countOfRandomizedPatients":0,"whenCreated":"2023-04-15T16:08:19Z","creator":"Paul Sanders","numberOfForms":1,"form":[{"name":"demographic.form.name.site.demographics","lastModified":"2023-04-15T16:08:19Z","whoLastModifiedName":"Paul Sanders","whoLastModifiedRole":"Project Manager","whenCreated":1681574834930,"hasErrors":false,"hasWarnings":false,"locked":false,"user":null,"dateTimeChanged":null,"formTitle":"Site Demographics","formIndex":1,"formGroup":"Demographic","formState":"In-Work","states":[{"value":"form.state.in.work","signer":"Paul Sanders - Project Manager","signerUniqueId":"1681162687395","dateSigned":"2023-04-15T16:08:19Z"}],"categories":[{"name":"Demographics","categoryType":"normal","highestIndex":0,"fields":[{"name":"company","fieldType":"text","dataType":"string","errorCode":"valid","whenCreated":"2023-04-15T16:07:14Z","keepHistory":true,"entries":[{"entryId":"1","value":{"by":"Paul Sanders","byUniqueId":"1681162687395","role":"Project Manager","when":"2023-04-15T16:08:19Z","value":"Some Company"},"reason":null}],"comments":[{"commentId":"1","value":{"by":"Paul Sanders","byUniqueId":"1681162687395","role":"Project Manager","when":"2023-04-15T16:09:02Z","value":"Some comment"}}]}]}]}]}]}'
45+
== '{"sites":[{"name":"Some Site","uniqueId":"1681574834910","numberOfPatients":4,"countOfRandomizedPatients":0,"whenCreated":"2023-04-15T16:08:19Z","creator":"Paul Sanders","numberOfForms":1,"form":[{"name":"demographic.form.name.site.demographics","lastModified":"2023-04-15T16:08:19Z","whoLastModifiedName":"Paul Sanders","whoLastModifiedRole":"Project Manager","whenCreated":1681574834930,"hasErrors":false,"hasWarnings":false,"locked":false,"user":null,"dateTimeChanged":null,"formTitle":"Site Demographics","formIndex":1,"formGroup":"Demographic","formState":"In-Work","states":[{"value":"form.state.in.work","signer":"Paul Sanders - Project Manager","signerUniqueId":"1681162687395","dateSigned":"2023-04-15T16:08:19Z"}],"categories":[{"name":"Demographics","categoryType":"normal","highestIndex":0,"fields":[{"name":"company","fieldType":"text","dataType":"string","errorCode":"valid","whenCreated":"2023-04-15T16:07:14Z","keepHistory":true,"entries":[{"entryId":"1","value":{"by":"Paul Sanders","byUniqueId":"1681162687395","role":"Project Manager","when":"2023-04-15T16:08:19Z","value":"Some Company"},"reason":null}],"comments":[{"commentId":"1","value":{"by":"Paul Sanders","byUniqueId":"1681162687395","role":"Project Manager","when":"2023-04-15T16:09:02Z","value":"Some comment"}}]}]}]}]}]}'
4646
)
4747

4848

4949
def test_parse_subject_native_file(subject_native_xml):
5050
result = parse_subject_native_file(subject_native_xml)
5151

5252
assert result.patients[0].patient_id == "ABC-001"
53+
assert result.patients[0].forms is not None
5354

5455

5556
def test_parse_subject_native_string(subject_native_xml):

0 commit comments

Comments
 (0)