-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tweak url proefix detection / ignores
- Loading branch information
Showing
1 changed file
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,8 @@ | |
parentDir = os.path.basename(parent) | ||
|
||
'''Creates main variables for use with UKCore and NHSE assets''' | ||
ukcoreVar = {'project':'UKCore','urlPrefix': 'https://fhir.hl7.org.uk/','codesystemPrefix':[],'org':'HL7 UK', 'email':'[email protected]'} | ||
nhseVar = {'project':'England','urlPrefix': 'https://fhir.nhs.uk/England/', 'codesystemPrefix':['https://ord.nhs.uk/'],'org':'NHS England', 'email':'[email protected]'} | ||
ukcoreVar = {'project':'UKCore','urlPrefix': 'https://fhir.hl7.org.uk/','ignoreURLPrefix':['http://hl7.org/fhir/5.0/'],'org':'HL7 UK', 'email':'[email protected]'} | ||
nhseVar = {'project':'England','urlPrefix': 'https://fhir.nhs.uk/England/', 'ignoreURLPrefix':['http://hl7.org/fhir/5.0/','https://ord.nhs.uk/'],'org':'NHS England', 'email':'[email protected]'} | ||
mainVar = {} | ||
if 'ukcore' in parentDir.lower(): | ||
mainVar = ukcoreVar | ||
|
@@ -99,20 +99,17 @@ | |
fileName = '-'.join(fileName.split('-')[1:]) | ||
if not fileName == elements['id']: | ||
warnings.append("\t\t"+elements['id']+" - the 'id' is incorrect") | ||
if not elements['url'].startswith('http://hl7.org/fhir/5.0/'): #passes any R5 extensions | ||
'''Check all url's unless they starts with one in the ignore list''' | ||
uriCheck=True | ||
for elem in mainVar['ignoreURLPrefix']: | ||
if elements['url'].startswith(elem): | ||
uriCheck=False | ||
break | ||
if uriCheck == True: | ||
if not fileName == elements['url'].split('/')[-1]: | ||
warnings.append("\t\t"+elements['url']+" - The 'url' element is incorrect") | ||
if not elements['url'].startswith(mainVar['urlPrefix']+assets[path]): | ||
if path == 'codesystems': | ||
uriCheck = False | ||
for elem in mainVar['codesystemPrefix']: | ||
if elements['url'].startswith(elem+assets[path]): | ||
uriCheck = True | ||
break | ||
if uriCheck == False: | ||
warnings.append("\t\t"+elements['url']+" - The 'url' element prefix is not one of :"+str(mainVar['urlPrefix'])+", "+", ".join(mainVar['codesystemPrefix'])) | ||
else: | ||
warnings.append("\t\t"+elements['url']+" - The 'url' element prefix is incorrect") | ||
warnings.append("\t\t"+elements['url']+" - The 'url' element prefix is incorrect") | ||
if not ''.join(fileName.split('-')) == elements['name'].split('/')[-1]: | ||
warnings.append("\t\t"+elements['name']+" - The 'name' element is incorrect") | ||
if not fileName.replace('-','') == elements['title'].replace(' ',''): | ||
|