Skip to content

Commit

Permalink
Merge pull request #125 from icanbwell/cd-DFP-1627
Browse files Browse the repository at this point in the history
ID update for Bwell FHIR v3 id support
  • Loading branch information
cdukebwell authored Jun 1, 2023
2 parents ad6108f + d72843a commit 0a84fc2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spark_auto_mapper_fhir/fhir_types/id.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def get_column_spec(
replacement="-",
),
0,
63,
1024 * 1024,
)
return column_spec
5 changes: 5 additions & 0 deletions tests/fhir_types/id/test_automapper_fhir_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_auto_mapper_fhir_id(spark_session: SparkSession) -> None:
[
(1, "Qureshi- / &&"),
(2, " Vidal. "),
(3, "BWELL-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),
],
["member_id", "last_name"],
).createOrReplaceTempView("patients")
Expand Down Expand Up @@ -49,3 +50,7 @@ def test_auto_mapper_fhir_id(spark_session: SparkSession) -> None:
result_df.where("member_id == 2").selectExpr("patient.id").collect()[0][0]
== "-Vidal.-"
)
assert (
result_df.where("member_id == 3").selectExpr("patient.id").collect()[0][0]
== "BWELL-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
)
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def test_auto_mapper_fhir_patient_resource(spark_session: SparkSession) -> None:
# Assert
assert len(sql_expressions) == 5
assert str(sql_expressions["id"]) == str(
substring(regexp_replace(col("b.member_id"), r"[^A-Za-z0-9\-\.]", "-"), 0, 63)
substring(
regexp_replace(col("b.member_id"), r"[^A-Za-z0-9\-\.]", "-"), 0, 1024 * 1024
)
.cast("string")
.alias("id")
)
Expand Down

0 comments on commit 0a84fc2

Please sign in to comment.