Skip to content

Commit

Permalink
updated MEASUREMENT_QUESTION_PREFIX and MEASUREMENT_ANSWER_PREFIX by …
Browse files Browse the repository at this point in the history
…adding numbers at the beginning to ensure the sorting will also place the question before the answer
  • Loading branch information
ChaoPang committed Oct 3, 2024
1 parent 9d31367 commit b457580
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cehrbert_data/const/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
NA = "N/A"
CONCEPT = "concept"
CONCEPT_ANCESTOR = "concept_ancestor"
MEASUREMENT_QUESTION_PREFIX = "Question:"
MEASUREMENT_ANSWER_PREFIX = "Answer:"
MEASUREMENT_QUESTION_PREFIX = "1-Question:"
MEASUREMENT_ANSWER_PREFIX = "2-Answer:"
4 changes: 2 additions & 2 deletions src/cehrbert_data/decorators/clinical_event_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def _decorate(self, patient_events: DataFrame):

categorical_measurement_events_question = categorical_measurement_events.withColumn(
"standard_concept_id",
F.concat(F.lit("1-"), F.lit(MEASUREMENT_QUESTION_PREFIX), F.col("measurement_components").getItem(0))
F.concat(F.lit(MEASUREMENT_QUESTION_PREFIX), F.col("measurement_components").getItem(0))
).drop("measurement_components")

categorical_measurement_events_answer = categorical_measurement_events.withColumn(
"standard_concept_id",
F.concat(F.lit("2-"), F.lit(MEASUREMENT_ANSWER_PREFIX), F.col("measurement_components").getItem(1))
F.concat(F.lit(MEASUREMENT_ANSWER_PREFIX), F.col("measurement_components").getItem(1))
).drop("measurement_components")

other_events = patient_events.where(F.col("domain") != CATEGORICAL_MEASUREMENT)
Expand Down

0 comments on commit b457580

Please sign in to comment.