forked from WorldVistA/VistA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
KIDSAssociatedFilesMapping.py
69 lines (66 loc) · 2.51 KB
/
KIDSAssociatedFilesMapping.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#---------------------------------------------------------------------------
# Copyright 2013 The Open Source Electronic Health Record Agent
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#---------------------------------------------------------------------------
"""
single file name => kids install name
"""
KIDS_SINGLE_FILE_ASSOCIATION_DICT = {
### Info Files Section
"CPRS GUI VERSION 28 NOTES.txt" : "MultiBuilds",
"EDP-2.TXT" : "EDP 2.0",
"MAG3_0P121.ReadMe.txt" : "MAG*3.0*121",
"MOCHA_1.txt" : "PSJ*5.0*261",
"PREC - PHARMACY ENTERPRISE CUSTOMIZATION SYSTEM RELEASE.txt" : "PREC*2.2*1",
"PREN Release.txt" : "PREN*1.0*1",
"Release of Patient Assessment Documentation Pkg_NUPA_1.txt" : "NUPA 1.0",
"Release of VA NATIONAL HEALTH INFO NETWORK NHIN_1.txt" : "NHIN 1.0",
"Update to NUPA_1.txt" : "NUPA 1.0",
"XOBU_1-6 Security Suite Utility Pack.txt" : "XOBU 1.6",
#### Global Files Section
"LEX_2_51.GBL": "LEX*2.0*51",
"LEX_2_74.GBL": "LEX*2.0*74",
"LEX_2_76.GBL": "LEX*2.0*76",
"LEX_2_77.GBL": "LEX*2.0*77",
"LEX_2_78.GBL": "LEX*2.0*78",
"LEX_2_79.GBL": "LEX*2.0*79",
"LEX_2_82.GBLs": "LEX*2.0*82",
"LEX_2_83.GBLs": "LEX*2.0*83",
"LEX_2_84.GBLs": "LEX*2.0*84",
"LEX_2_89.GBLs": "LEX*2.0*89",
"LEX_2_90.GBLs": "LEX*2.0*90",
}
"""
regular expression match => kids install name
"""
KIDS_GROUP_FILES_ASSOCIATION_DICT = {
"IBRC1101[A-F].TXT" : "IB*2.0*445",
"IBRC1110[A-F].TXT" : "IB*2.0*462",
"IBRC1201[A-F].TXT" : "IB*2.0*468",
"IBRC1210[A-F].TXT" : "IB*2.0*484",
"IBRC1301[A-F].TXT" : "IB*2.0*491",
}
def getAssociatedInstallName(fileName):
import os
import re
from ConvertToExternalData import isValidSha1Suffix
basename = os.path.basename(fileName)
if isValidSha1Suffix(basename):
basename = basename[:basename.rfind('.')]
if basename in KIDS_SINGLE_FILE_ASSOCIATION_DICT:
return KIDS_SINGLE_FILE_ASSOCIATION_DICT[basename]
for regExp in KIDS_GROUP_FILES_ASSOCIATION_DICT:
if re.search(regExp, basename):
return KIDS_GROUP_FILES_ASSOCIATION_DICT[regExp]
return None