import sys import os from biocypher import BioCypher from schema_config_generation import write_automated_schema # Add submodule to path BEFORE any other imports sys.path.insert(0, '/app/mdm2neo4j/src') # Absolute path in Docker # OR #sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'mdm2neo4j')) # Relative path # Now your imports should work import mdm2neo4j.src.xml_processor.xml_processor as xp from import_fhir_to_nx_diGraph import generate_neo4j_import_script from import_fhir_to_nx_diGraph import load_multiple_fhir_patients #import mdm2neo4j.src.xml_processor.xml_processor as xp def main(): # create Biocypher driver bc = BioCypher( biocypher_config_path="config/biocypher_config.yaml", ) #bc.show_ontology_structure() #very extensive #BioCypher preperation ## create networkX and run improvement scripts adapter_mode = 0 xml_file_path = "./odm_models" write_automated_schema(None, 'config/automated_schema.yaml', ['config/manual_schema_config.yaml', 'config/ODM_schema.yaml']) if(adapter_mode == 0 or adapter_mode == -1): n_patients = int(os.getenv('NUMBER_OF_PATIENTS')) print("--- load ", n_patients, " fhir patients ---") load_multiple_fhir_patients(n_patients) if(adapter_mode == 1 or adapter_mode == -1): #bc.show_ontology_structure() #very extensive bc.write_nodes(xp.parse_xml_generate_nodes(xml_file_path)) bc.write_edges(xp.parse_xml_generate_edges(xml_file_path)) print("CREATING THE SCRIPT", flush=True) generate_neo4j_import_script() with open('/neo4j_import/shell-scipt-complete', 'w') as f: f.write('Import completed successfully') print("FHIR import completed successfully") if __name__ == "__main__": main()