Esempio n. 1
0
def test_run_override(mock_datetime, with_concept_maps):
    mock_datetime.now.return_value = mockdatetime()
    run.run(
        mapping="test/fixtures/small_mimic_mapping.json",
        resource_ids=None,
        override=False,
        chunksize=None,
        bypass_validation=False,
        skip_ref_binding=True,
        multiprocessing=False,
    )
    run.run(
        mapping="test/fixtures/small_mimic_mapping.json",
        resource_ids=None,
        override=True,
        chunksize=None,
        bypass_validation=False,
        skip_ref_binding=True,
        multiprocessing=False,
    )
    mongo_client = get_mongo_client()[fhirpipe.global_config["fhirstore"]
                                      ["database"]]
    assert mongo_client["Patient"].count_documents(
        {}) == expected_patients_count
    assert mongo_client["Practitioner"].count_documents(
        {}) == expected_admissions_count
Esempio n. 2
0
def test_run_multiprocessing(mock_datetime, with_concept_maps):
    mock_datetime.now.return_value = mockdatetime()
    run.run(
        mapping="test/fixtures/mimic_mapping.json",
        resource_ids=None,
        override=False,
        chunksize=None,
        bypass_validation=False,
        skip_ref_binding=True,
        multiprocessing=True,
    )
    assert_result_as_expected()
Esempio n. 3
0
def cli_run():
    print(WELCOME_MSG)

    # Parse arguments
    args = parse_args()

    # Define global config
    set_global_config(config_path=args.config)

    # Setup logging configuration
    setup_logging()

    run(
        mapping=args.mapping,
        resource_ids=args.resource_ids,
        override=args.override,
        chunksize=args.chunksize,
        bypass_validation=args.bypass_validation,
        skip_ref_binding=args.skip_ref_binding,
        multiprocessing=args.multiprocessing,
    )
Esempio n. 4
0
def test_run_ref_binding(mock_datetime, with_concept_maps):
    mock_datetime.now.return_value = mockdatetime()
    run.run(
        mapping="test/fixtures/small_mimic_mapping.json",
        resource_ids=None,
        override=False,
        chunksize=None,
        bypass_validation=False,
        skip_ref_binding=False,
        multiprocessing=False,
    )

    mongo_client = get_mongo_client()[fhirpipe.global_config["fhirstore"]
                                      ["database"]]

    db_collections = mongo_client.list_collection_names()
    assert "Patient" in db_collections
    assert "Practitioner" in db_collections
    assert mongo_client["Patient"].count_documents(
        {}) == expected_patients_count

    compare_sample_patient_referencing(mongo_client)