Skip to content

Commit

Permalink
update Excel template with AllowedValue instead of PropertyValue
Browse files Browse the repository at this point in the history
  • Loading branch information
atomczak committed May 10, 2023
1 parent cc8d7fe commit f72e627
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 4 deletions.
56 changes: 56 additions & 0 deletions Model/Import Model/examples/bsdd-minimum-import-file.json
@@ -0,0 +1,56 @@
{
"OrganizationCode": "text",
"DomainCode": "text",
"DomainVersion": "text",
"DomainName": "text",
"LanguageIsoCode": "text",
"LanguageOnly": false,
"UseOwnUri": false,
"Classifications": [
{
"Code": "text",
"Name": "text",
"ClassificationType": "text",
"ClassificationRelations": [
{
"RelationType": "text",
"RelatedClassificationUri": "text"
}
],
"ClassificationProperties": [
{
"Code": "text",
"PropertyCode": "text",
"PropertyNamespaceUri": "text",
"AllowedValues": [
{
"Code": "text",
"Value": "text"
}
]
}
]
}
],
"Properties": [
{
"Code": "text",
"Description": "text",
"Name": "text",

"AllowedValues": [
{
"Code": "text",
"Value": "text"
}
],

"PropertyRelations": [
{
"RelationType": "text",
"RelatedPropertyUri": "text"
}
]
}
],
}
Expand Up @@ -44,7 +44,7 @@ def load_excel(EXCEL_PATH):
excel['property'] = pd.read_excel(excel_df, 'Property', skiprows=5, usecols="C:AU", true_values="TRUE")
excel['classificationproperty'] = pd.read_excel(excel_df, 'ClassificationProperty', usecols="C:T", skiprows=5, true_values="TRUE")
excel['classificationrelation'] = pd.read_excel(excel_df, 'ClassificationRelation', usecols="C:G", skiprows=5, true_values="TRUE")
excel['propertyvalue'] = pd.read_excel(excel_df, 'PropertyValue', skiprows=5, usecols="C:I", true_values="TRUE")
excel['allowedvalue'] = pd.read_excel(excel_df, 'AllowedValue', skiprows=5, usecols="C:I", true_values="TRUE")
excel['propertyrelation'] = pd.read_excel(excel_df, 'PropertyRelation', skiprows=5, usecols="C:F", true_values="TRUE")
return excel

Expand Down Expand Up @@ -120,8 +120,8 @@ def excel2bsdd(excel):
related = cls_rel['(Origin Classification Code)']
cls_rel.pop("(Origin Classification Code)")
next(item for item in bsdd_data['Classifications'] if item["Code"] == related)['ClassificationRelations'].append(cls_rel)
# process PropertyValue
prop_vals = jsonify(excel['propertyvalue'], AllowedValue)
# process AllowedValue
prop_vals = jsonify(excel['allowedvalue'], AllowedValue)
for prop_val in prop_vals:
# only one of the two Code columns is possible:
if prop_val['(Origin Property Code)']:
Expand All @@ -136,7 +136,7 @@ def excel2bsdd(excel):
# iterate all properties and add AllowedValue if present in spreadsheet
next(item for item in bsdd_data['Properties'] if item["Code"] == related)['AllowedValues'].append(prop_val)
else:
# iterate all classifications to find the one referenced by property value
# iterate all classifications to find the one referenced by the property value
for classification in bsdd_data['Classifications']:
next(item for item in classification['ClassificationProperties'] if item["PropertyCode"] == related)['AllowedValues'].append(prop_val)
# process PropertyRelation
Expand Down
Binary file not shown.
Binary file modified Model/Import Model/spreadsheet-import/bSDD_Excel_template.xlsx
Binary file not shown.

0 comments on commit f72e627

Please sign in to comment.