Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempting to fix OutputFileValidator so that whatever views are specified via ignore_views_for_output are not used to generate the output files and schema and are not used for comparison #117

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions spark_pipeline_framework_testing/test_classes/validator_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def __init__(
sort_output_by: Optional[List[str]] = None,
output_as_json_only: bool = True,
apply_schema_to_output: bool = True,
ignore_views_for_output: Optional[List[str]] = None,
ignore_views_for_output: List[str] = [],
output_folder: str = "output",
output_schema_folder: str = "output_schema",
output_schema: Optional[
Expand Down Expand Up @@ -709,7 +709,7 @@ def validate(
if not table_name.startswith("expected_")
and table_name not in self.input_table_names
]
if self.ignore_views_for_output is not None:
if self.ignore_views_for_output:
output_tables_for_writing_schema = [
table
for table in output_tables_for_writing_schema
Expand All @@ -732,10 +732,13 @@ def validate(
if not os.path.exists(self.output_folder_path):
os.mkdir(self.output_folder_path)
# noinspection PyTypeChecker
output_files: List[str] = [
output_files = [
f
for f in listdir(self.output_folder_path)
if isfile(join(self.output_folder_path, f))
if (
isfile(join(self.output_folder_path, f))
and Path(f).stem not in self.ignore_views_for_output
)
]
views_found: List[str] = []
data_frame_exceptions: List[SparkDataFrameComparerException] = []
Expand Down Expand Up @@ -764,6 +767,7 @@ def validate(
if table_name.lower() not in views_found
and not table_name.startswith("expected_")
and table_name not in self.input_table_names
and table_name not in self.ignore_views_for_output
]
if (
"output" in table_names_to_write_to_output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def test_practitioner(spark_session: SparkSession) -> None:

input_file = FileInput()

logger = get_logger(__name__)
logger = get_logger(__name__)
SparkPipelineFrameworkTestRunnerV2(
spark_session=spark_session,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"type": "struct",
"fields": [
{
"name": "provider_last_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "provider_first_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "provider_middle_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "provider_gender",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "provider_title",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "provider_npi",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "gecb_provider_number",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "age_group_seen",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "primary_care_physician",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "speciality_care_provider",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "preferred_provider",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "accept_new_patients",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "accept_medstar_select_insurance",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "telehealth_provider",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "alias",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "facility",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_address1",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_address2",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_city",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_state",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_zip",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_mnem",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_location_number",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_department_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_department_mnem",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "scheduling_department_number",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "practice_name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "customer_friendly_practice_name",
"type": "string",
"nullable": true,
"metadata": {}
}
],
"$schema": "https://raw.githubusercontent.com/imranq2/SparkPipelineFramework.Testing/main/spark_json_schema.json "
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "struct",
"fields": [
{
"name": "diagnosis_id",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "member_id",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "icd_code",
"type": "string",
"nullable": true,
"metadata": {}
}
],
"$schema": "https://raw.githubusercontent.com/imranq2/SparkPipelineFramework.Testing/main/spark_json_schema.json "
}
24 changes: 24 additions & 0 deletions tests/library/features/v2/response_text/input_schema/members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "struct",
"fields": [
{
"name": "member_id",
"type": "long",
"nullable": true,
"metadata": {}
},
{
"name": "name",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "birth_date",
"type": "string",
"nullable": true,
"metadata": {}
}
],
"$schema": "https://raw.githubusercontent.com/imranq2/SparkPipelineFramework.Testing/main/spark_json_schema.json "
}
Loading
Loading