Skip to content

Commit

Permalink
Be clear on copying parquet and getting messages
Browse files Browse the repository at this point in the history
  • Loading branch information
stefpiatek committed Dec 21, 2023
1 parent 875147b commit 4375f96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions cli/src/pixl_cli/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def messages_from_state_file(filepath: Path) -> list[Message]:
]


def messages_from_parquet(dir_path: Path) -> list[Message]:
def copy_public_parquet_and_build_messages(dir_path: Path) -> list[Message]:
"""
Reads patient information from parquet files within directory structure
and transforms that into messages.
and transforms that into messages. Copies the public parquet files to extracts.
:param dir_path: Path for parquet directory containing private and public
files
"""
Expand Down
4 changes: 2 additions & 2 deletions cli/src/pixl_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from core.patient_queue.producer import PixlProducer
from core.patient_queue.subscriber import PixlBlockingConsumer

from ._io import messages_from_parquet, messages_from_state_file
from ._io import copy_public_parquet_and_build_messages, messages_from_state_file
from ._logging import logger, set_log_level
from ._utils import clear_file, remove_file_if_it_exists

Expand Down Expand Up @@ -88,7 +88,7 @@ def populate(parquet_dir: Path, *, restart: bool, queues: str) -> None:
└── extract_summary.json
"""
logger.info(f"Populating queue(s) {queues} from {parquet_dir}")
messages = messages_from_parquet(parquet_dir)
messages = copy_public_parquet_and_build_messages(parquet_dir)

for queue in queues.split(","):
state_filepath = state_filepath_for_queue(queue)
Expand Down
5 changes: 2 additions & 3 deletions cli/tests/test_messages_from_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from pathlib import Path

from core.patient_queue.message import Message

from cli.build.lib.pixl_cli.main import messages_from_parquet
from pixl_cli._io import copy_public_parquet_and_build_messages


def test_messages_from_parquet(resources: Path) -> None:
Expand All @@ -27,7 +26,7 @@ def test_messages_from_parquet(resources: Path) -> None:
The test data doesn't have any "difficult" cases in it, eg. people without procedures.
"""
omop_parquet_dir = resources / "omop"
messages = messages_from_parquet(omop_parquet_dir)
messages = copy_public_parquet_and_build_messages(omop_parquet_dir)
assert all(isinstance(msg, Message) for msg in messages)

expected_messages = [
Expand Down

0 comments on commit 4375f96

Please sign in to comment.