in src/loading_manifest/osdu_wellborepath_manifest.py [0:0]
def create_wellborepath_manifest(wellborepath_name, preload_file_path, file_source,
wellbore_id, top_md, base_md,
schema_ns_name, schema_ns_value, acl, legal,
schema_version, dict_schemas):
kind_wp = None
kind_wpc = None
kind_file = None
schema_id_lm = None
schema_id_wp = None
schema_id_wpc = None
schema_id_file = None
if schema_version == SCHEMA_VERSION_1_0_0:
kind_wp = cm.WorkProductManifest.KIND_GENERIC_WORK_PRODUCT_1_0_0
kind_wpc = cm.WorkProductComponentManifest.KIND_WELLBORE_PATH_1_0_0
kind_file = cm.FileManifest.KIND_ID_GENERIC_DATASET_1_0_0
schema_id_lm = cm.LoadingManifest.SCHEMA_ID_1_0_0
schema_id_wp = cm.WorkProductManifest.SCHEMA_ID_GENERIC_WORK_PRODUCT_1_0_0
schema_id_wpc = cm.WorkProductComponentManifest.SCHEMA_ID_WELLBORE_PATH_1_0_0
schema_id_file = cm.FileManifest.SCHEMA_ID_GENERIC_DATASET_1_0_0
elif schema_version == SCHEMA_VERSION_1_1_0:
kind_wp = cm.WorkProductManifest.KIND_GENERIC_WORK_PRODUCT_1_0_0
kind_wpc = cm.WorkProductComponentManifest.KIND_WELLBORE_PATH_1_1_0
kind_file = cm.FileManifest.KIND_ID_GENERIC_DATASET_1_0_0
schema_id_lm = cm.LoadingManifest.SCHEMA_ID_1_0_0
schema_id_wp = cm.WorkProductManifest.SCHEMA_ID_GENERIC_WORK_PRODUCT_1_0_0
schema_id_wpc = cm.WorkProductComponentManifest.SCHEMA_ID_WELLBORE_PATH_1_1_0
schema_id_file = cm.FileManifest.SCHEMA_ID_GENERIC_DATASET_1_0_0
# create the work product manifest
wp = cm.create_work_product_manifest(
kind=kind_wp,
acl=acl,
legal=legal,
resource_security_classificaton=cm.ResourceSecurityClassification.RESTRICTED,
name=wellborepath_name,
description=cm.WorkProductManifest.DESCRIPTION_WELLBORE_PATH
)
# create the work product component manifest
wpc = cm.create_work_product_component_manifest(
kind=kind_wpc,
acl=acl,
legal=legal,
resource_security_classificaton=cm.ResourceSecurityClassification.RESTRICTED,
name=wellborepath_name,
description=cm.WorkProductComponentManifest.DESCRIPTION_WELLBORE_PATH
)
wpc_data = wpc[cm.WorkProductComponentManifest.TAG_DATA]
wpc_data[cm.WorkProductComponentManifest.TAG_DATA_WELL_BORE_ID] \
= cm.WorkProductComponentManifest.WELL_BORE_ID + cm.url_quote(wellbore_id) + ":"
if top_md is not None:
wpc_data[cm.WorkProductComponentManifest.TAG_DATA_TOP_MD] = top_md
if base_md is not None:
wpc_data[cm.WorkProductComponentManifest.TAG_DATA_BASE_MD] = base_md
wpc_data[cm.WorkProductComponentManifest.TAG_DATA_VERTICAL_MEASUREMENT] = {}
# create the wellborepath file manifest
wellborepath_file_name = wellborepath_name
f_doc = cm.create_file_manifest(
kind=kind_file,
schema_format_type=cm.FileManifest.SCHEMA_FORMAT_TYPE_ID_CVS,
acl=acl,
legal=legal,
resource_security_classificaton=cm.ResourceSecurityClassification.RESTRICTED,
preload_file_path=(preload_file_path + wellborepath_file_name),
file_source=("" if file_source is None or len(file_source) == 0
else (file_source + wellborepath_file_name)),
file_name=wellborepath_file_name
)
# associate wpc with wp
cm.associate_work_product_components(wp, [wpc])
# associate wellborepath file with wpc
cm.associate_files(wpc, [f_doc])
# create wellborepath loading manifest
wellborepath = cm.create_loading_manifest(
work_product=wp,
work_product_components=[wpc],
files=[f_doc],
schema_id_lm=schema_id_lm,
schema_id_wp=schema_id_wp,
schema_id_wpc=schema_id_wpc,
schema_id_file=schema_id_file,
schema_ns_name=schema_ns_name,
schema_ns_value=schema_ns_value,
dict_schemas=dict_schemas
)
return wellborepath