forked from TopologyHealth/Spreadsheet-to-ConceptMap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.py
54 lines (51 loc) · 1.72 KB
/
script.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
import json
import csv
from datetime import date
today = date.today()
with open ('Scott_Query_wscPopulated.xlsx - Sheet1.csv', 'r') as f1:
reader = csv.reader(f1)
next(reader)
groupElements = []
for index, row in enumerate(reader):
if(len(row[14].split('|'))>1):
groupElements.append({
'code':row[9],
'display':row[11],
'target':[{
'code':row[14].split('|')[0][:-1],
'display':row[14].split('|')[1],
'equivalence':'equivalent'
}]
})
data =[]
data.append({
"resourceType": "ConceptMap",
"status": "draft",
'name': 'CAPCkeyToSNOMEDmap',
'title': 'CAPCkeyToSNOMEDmap',
'experimental': True,
'date': str(today),
'publisher': 'College of American Pathologists',
"contact":[
{
"telecom": [
{
"system": "email",
"value": "[email protected]"
}
]
}],
'description': 'mapping of SNOMED to CAP CKeys',
'purpose': 'mapping of SNOMED to CAP CKeys',
'copyright': 'College of American Pathologists 2022',
'group':[
{
'source': 'http://cap.org/eCC',
'target': 'http://snomed.info/sct',
'element':
groupElements
}
]
})
with open('./NotFormatted/CAPCkeyToSNOMEDmapNotFormatted.json', 'w') as f:
json.dump(data,f,indent=4, allow_nan=False)