Skip to content

Commit

Permalink
Merge pull request #18 from NHSDigital/fix/capstate
Browse files Browse the repository at this point in the history
added try except for capability statement
  • Loading branch information
ryma2fhir authored Oct 5, 2023
2 parents 359a56a + f10f63f commit 69516ac
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions QualityControlChecker/QualityControlChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,24 @@
print("\t",example,"The 'id' element is incorrect")

'''CapabilityStatement Checker - checks if all Profiles are in the CapabilityStatement'''
tree= ET.parse('./CapabilityStatement/CapabilityStatement-'+mainVar['project']+'.xml')
root = tree.getroot()
try:
tree= ET.parse('./CapabilityStatement/CapabilityStatement-'+mainVar['project']+'.xml')
root = tree.getroot()
except:
root = None

print('CapabilityStatement')
capabilityStatement = []
for tag in root.findall('.//{*}type'):
capabilityStatement.append(tag.attrib["value"])
if root != None:
print('CapabilityStatement')
capabilityStatement = []
for tag in root.findall('.//{*}type'):
capabilityStatement.append(tag.attrib["value"])

for p in currentProfiles:
if p not in capabilityStatement:
error=True
print("\t",p,"is missing from the CapabilityStatement")
for p in currentProfiles:
if p not in capabilityStatement:
error=True
print("\t",p,"is missing from the CapabilityStatement")

''' If any QC issues found within the script, cause the action to fail'''
if error == True:
print("\nPlease fix the errors found above")
sys.exit(2)
Expand Down

0 comments on commit 69516ac

Please sign in to comment.