Skip to content
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
22 changes: 10 additions & 12 deletions PlantUML/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ def write_to_plantuml_file(data, file_path):
f.write("hide class fields\n")
f.write("\npackage IG #DDDDDD{\n")
resource = ""
cptClass = 0
cpt_class = 0

f.write("\n package Profiles #DDDDDD{\n")
for count,row in enumerate(data):
if(row[2]!='Extension'):
if(resource!=row[0]) :
if(cptClass !=0) :
if(cpt_class !=0) :
f.write( "\n } \n")
f.write( "\n class " + row[0] +"{\n")
cptClass = cptClass + 1
cpt_class = cpt_class + 1
if(row[2] != row[3]) :
f.write("\n "+ row[4] )
f.write(" => ");
Expand All @@ -80,26 +80,25 @@ def write_to_plantuml_file(data, file_path):

#Ecritures des dépendances avec les extension
resource = ""
cptClass = 0
cpt_class = 0
for count,row in enumerate(data):
if(row[2]!='Extension'):
if((row[2] != row[3]) and (str(row[13]) != 'None')) :
if( "extension:" in row[4]) :
f.write('\n ' + row[0] + ' -[#black,dashed,thickness=2]-> ' + str(row[13]) +"")
resource = row[0]
f.write("\n")


resource = ""
cptClass = 0
cpt_class = 0
for count,row in enumerate(data):

if(row[2] =='Extension'):
if(resource!=row[0]) :
if(cptClass !=0) :
if(cpt_class !=0) :
f.write( "\n } ")
f.write( "\n class " + str(row[0]) +"{\n")
cptClass = cptClass + 1
cpt_class = cpt_class + 1
if(row[2] != row[3]) :
f.write("\n " +row[4] )
f.write(" => ");
Expand All @@ -122,10 +121,9 @@ def write_to_plantuml_file(data, file_path):
resource = ""
for count,row in enumerate(data):

if(resource!=row[0]) :
if(row[2] != 'Extension') :
f.write( '\n class "' + row[2] +'" as ' + f"class{hashlib.md5(row[2].encode()).hexdigest()}" +" \n")
f.write( "\n " + f"class{hashlib.md5((row[2].encode())).hexdigest()}" + " --> " + row[0] +"\n")
if(resource!=row[0]) and (row[2] != 'Extension') :
f.write( '\n class "' + row[2] +'" as ' + f"class{hashlib.md5(row[2].encode()).hexdigest()}" +" \n")
f.write( "\n " + f"class{hashlib.md5((row[2].encode())).hexdigest()}" + " --> " + row[0] +"\n")
resource = row[0]
f.write("}")

Expand Down
1 change: 0 additions & 1 deletion PlantUML/construct_mapping_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
for elem in mapping:
# Niveau ressource
if row[1] == row[2]:
if resource not in extracted_data.keys():

Check warning on line 69 in PlantUML/construct_mapping_global.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1CiwkMzlxAm-KnV3&open=AZ4G1CiwkMzlxAm-KnV3&pullRequest=31
extracted_data[resource] = {'profil_id': row[6].split('/')[-1], 'base_fhir': row[1], 'urls': [row[5], row[6]], 'mapping': [], 'links': {}}
extracted_data[resource]['mapping'].append(elem['map'])
# Récupération des références
Expand All @@ -93,7 +93,6 @@
color = ''
if profil in colors.keys():
color = ' #' + colors[profil]['header']
mapping_ids = []
for mapping in profil_infos['mapping']:
mapping_id = keep_alnum(mapping)
# Un rectangle par classe fonctionnelle (avec un couleur par profil FHIR)
Expand Down
2 changes: 1 addition & 1 deletion PlantUML/construct_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@
def structure_data(extracted_data):
structured_data = {}
# Itération sur les mappings (il peut y en avoir plusieurs par ressource)
for mapping in list(extracted_data['resources'].values()):
for mapping in extracted_data['resources'].values():
resource_fhir = mapping['resource']
class_func = mapping['class']
elements = mapping['elements']
references = mapping['references']
if resource_fhir not in structured_data.keys():

Check warning on line 136 in PlantUML/construct_mappings.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1Cg0kMzlxAm-KnVy&open=AZ4G1Cg0kMzlxAm-KnVy&pullRequest=31
# Un dictionnaire par profil FHIR
structured_data[resource_fhir] = {}
# Pour chaque classe fonctionnelle, on distingue les éléments simples, les éléments complexes, les extensions et les références
Expand All @@ -153,14 +153,14 @@
# Elément de second niveau
if '.' in elem_fhir_sub:
elem_fhir_sub_base, elem_fhir_sub_sub = elem_fhir_sub.split('.', 1)
if elem_fhir_base not in complex_elements.keys():

Check warning on line 156 in PlantUML/construct_mappings.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1Cg0kMzlxAm-KnVz&open=AZ4G1Cg0kMzlxAm-KnVz&pullRequest=31
complex_elements[elem_fhir_base] = {}
if elem_fhir_sub_base not in complex_elements[elem_fhir_base].keys():
complex_elements[elem_fhir_base][elem_fhir_sub_base] = {}
complex_elements[elem_fhir_base][elem_fhir_sub_base][elem_fhir_sub_sub] = elem_func
# Elément de premier niveau
else:
if elem_fhir_base not in complex_elements.keys():

Check warning on line 163 in PlantUML/construct_mappings.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1Cg0kMzlxAm-KnV0&open=AZ4G1Cg0kMzlxAm-KnV0&pullRequest=31
complex_elements[elem_fhir_base] = {}
complex_elements[elem_fhir_base][elem_fhir_sub] = elem_func
else:
Expand All @@ -169,14 +169,14 @@
for ref in references:
elem_fhir = ref['fhir']
elem_fhir = elem_fhir.split('.', 1)[1]
if elem_fhir not in reference_elements.keys():

Check warning on line 172 in PlantUML/construct_mappings.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1Cg0kMzlxAm-KnV1&open=AZ4G1Cg0kMzlxAm-KnV1&pullRequest=31
reference_elements[elem_fhir] = {'resource': ref['target_profile'].split('/')[-1] , 'mapping': [ref['mapping']]}
else:
reference_elements[elem_fhir]['mapping'].append(ref['mapping'])
structured_data[resource_fhir][class_func]['references'] = reference_elements
# Structuration des informations
for fhir_complex, func_complex in complex_elements.items():
if fhir_complex in simple_elements.keys():

Check warning on line 179 in PlantUML/construct_mappings.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary "keys()" call.

See more on https://sonarcloud.io/project/issues?id=ansforge_IG-workflows&issues=AZ4G1Cg0kMzlxAm-KnV2&open=AZ4G1Cg0kMzlxAm-KnV2&pullRequest=31
structured_data[resource_fhir][class_func]['complex_elements'][fhir_complex] = {'mapping': simple_elements[fhir_complex], 'elements': func_complex}
else:
structured_data[resource_fhir][class_func]['complex_elements'][fhir_complex] = {'mapping': None, 'elements': func_complex}
Expand Down