### ===================================================================================================================
### MYVIIA get information from webtool
### ===================================================================================================================
# Copyright ©VIIA 2025
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING
import ast
import requests
from requests import Response
from pathlib import Path
from typing import Optional, List, Dict, Union
from PIL import Image
import io
# Import ViiaSettings for server URL
from viiapackage.viiaSettings import ViiaSettings
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
from viiapackage.database.viia_myviia import myviia_token, myviia_login, _viia_get_from_myviia, myviia_check_modules
### ===================================================================================================================
### 2. API functions to get information from MYVIIA
### ===================================================================================================================
@myviia_token
def myviia_get_all_objects(token: Optional[str] = None) -> List:
"""
Function to collect the list of all objects in the MYVIIA webtool.
Input:
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a list of all objects in the VIIA database with basic information (for detailed object information use
myviia_get_object function).
"""
# Collect the information of the VIIA objects
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/viia_object/', token=token).json()
@myviia_token
def myviia_get_all_objects_for_user(token: Optional[str] = None) -> List[Dict[str, Union[int, str]]]:
"""
Function to collect the list of all objects assigned to user in the MYVIIA webtool.
Input:
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a list of all objects assigned to the user (structural engineer). This is retrieved from planning on
items BKCL, BSC, TVA-ENG and TVA in the overall VIIA planning. The list retrieved consists of dictionaries
for each object that the structural engineer is assigned to. The keys in these dictionaries are
'viiaobject_id' and 'viiaobject_nummer'.
"""
# Collect the information of the VIIA objects assigned
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/viia_object_user/', token=token).json()
@myviia_token
def myviia_get_user_info(token: Optional[str] = None) -> Dict[str, any]:
"""
Function to collect the information on the current user in MYVIIA webtool. Note that only user information can be
retrieved from the user self.
Input:
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with user information from MYVIIA.
"""
# Collect the information of the VIIA objects assigned
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/hr_resource/user/', token=token).json()
@myviia_token
def myviia_get_object(object_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect detailed information from specific object in the MYVIIA webtool.
Input:
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with the specific information of the requested object in the MYVIIA webtool.
"""
# Collect the detailed information of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/viia_object/{object_id}', token=token).json()['viia_object']
@myviia_token
def myviia_get_objectdelen(object_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect the object-part numbers of specific object in the MYVIIA webtool.
Input:
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with the specific information of the requested object in the MYVIIA webtool.
"""
# Collect the object-parts of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/viia_object/objectdelen/{object_id}',
token=token).json()['viia_object']
[docs]def myviia_get_object_part_details(object_part_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect detailed information from specific object on the object-parts in the MYVIIA webtool.
Input:
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with the specific information of the requested object in the MYVIIA webtool.
"""
# Collect the detailed information of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_deel/objectDeelForObjectDetails/{object_part_id}',
token=token).json()
@myviia_token
def myviia_get_object_team(object_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect the team members active on the specific object in the MYVIIA webtool.
Input:
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with the team information for the requested VIIA object from MYVIIA webtool.
"""
# Collect the detailed information of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/resource/{object_id}', token=token).json()['viia_object']
def _myviia_download_image(image_link: Response, new_image_file: Optional[Path] = None) -> Optional[Union[Path, Image]]:
""" Helper function to download the image and store on local system."""
# Decode the link in the response
try:
raw_data = image_link.content.decode('UTF-8')
except UnicodeDecodeError:
return None
try:
data = ast.literal_eval(raw_data)
except SyntaxError:
data = raw_data
# Download the image in the link received from MYVIIA
if isinstance(data, dict) and 'imageURL' in data:
viia_image = requests.get(url=data['imageURL'])
elif isinstance(data, str):
viia_image = requests.get(url=data)
else:
return None
# Save images in the requested images folder
if viia_image.status_code == 200:
# Return image as Image object
if new_image_file is None:
# Create an in-memory stream from the binary data
stream = io.BytesIO(viia_image.content)
# Open the image from the stream
return Image.open(stream)
# Return the path of the image on the local system
with open(new_image_file, 'wb') as out_file:
out_file.write(viia_image.content)
return new_image_file
# If picture was not found, available or corrupt None is returned
return None
@myviia_token
def myviia_get_image(
image: str, object_id: int, images_folder: Path, name: str, token: Optional[str] = None) -> Optional[Path]:
"""
Function to collect the images of a specific object in the MYVIIA webtool.
Input:
- image (str): Select the image to collect. Currently, API is available for 'building', 'opname' and
'engineering'.
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- images_folder (path): Path where to save the downloaded image.
- name (str): Name for the image.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Downloads the images from MYVIIA tool and saves it in the requested folder and with requested name.
"""
# Collect the requested image of the VIIA object
image_link = _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_images/{image}/{object_id}', token=token, stream=True)
# Check if a link is received
if image_link.status_code == 200:
if images_folder:
return _myviia_download_image(image_link=image_link, new_image_file=images_folder / f'{name}.png')
return _myviia_download_image(image_link=image_link)
return None
@myviia_token
def myviia_get_object_image(
image: str, object_deel_id: int, name: str, token: Optional[str] = None, images_folder: Path = None) -> \
Optional[Path]:
"""
Function to collect the images of a specific object in the MYVIIA webtool.
Input:
- image (str): Select the image to collect. Currently, API is available for 'building', 'opname' and
'engineering'.
- object_deel_id (int): ID of the objectpart in the MYVIIA webtool.
- name (str): Name for the image.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
- images_folder (path): Path where to save the downloaded image. If no path is given the picture will not be
saved but returned as object.
Output:
- Downloads the images from MYVIIA tool and return the picture object or saves it in the requested folder and
with requested name.
"""
# Collect the requested image of the VIIA object
image_link = _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_images/object_deel/{image}/{object_deel_id}', token=token,
stream=True)
# Check if a link is received
if image_link.status_code == 200:
if images_folder:
return _myviia_download_image(image_link=image_link, new_image_file=images_folder / f'{name}.png')
return _myviia_download_image(image_link=image_link)
return None
@myviia_token
def myviia_get_opname_image(
image: str, object_deel_opname_id: int, images_folder: Path, name: str, token: Optional[str] = None) \
-> Optional[Path]:
"""
Function to collect the images of a specific object in the MYVIIA webtool.
Input:
- image (str): Select the image to collect.
- object_deel_opname_id (int): ID of the VIIA object_deel_opname in the MYVIIA webtool.
- images_folder (path): Path where to save the downloaded image.
- name (str): Name for the image.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Downloads the images from MYVIIA tool and saves it in the requested folder and with requested name.
- If successful, the image file is returned as Path.
"""
# Collect the requested image of the VIIA object
image_link = _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/{image}/{object_deel_opname_id}', token=token, stream=True)
# Check if a link is received
if image_link.status_code == 200:
if images_folder:
return _myviia_download_image(image_link=image_link, new_image_file=images_folder / f'{name}.png')
return _myviia_download_image(image_link=image_link)
return None
@myviia_token
def myviia_get_object_deel(object_deel_id: int, token: Optional[str] = None, ref_objects: bool = False) -> Dict:
"""
Function to collect detailed information from specific object part in the MYVIIA webtool.
Input:
- object_deel_id (int): ID of the VIIA object part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
- ref_objects (bool): Select to get the objectspart for reference approach for the selected object part.
Output:
- Returns a dictionary with the specific information of the requested object part in the MYVIIA webtool.
"""
if ref_objects:
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_deel/engRefObjects/{object_deel_id}', token=token).json()
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_deel/{object_deel_id}', token=token).json()
@myviia_token
def myviia_get_deliverables(object_deel_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect deliverables from specific object part in the MYVIIA webtool.
Input:
- object_deel_id (int): ID of the VIIA object part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
- ref_objects (bool): Select to get the objectparts for reference approach for the selected object part.
Output:
- Returns a dictionary with the specific information of the requested object part in the MYVIIA webtool.
"""
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_deel/deliverables/{object_deel_id}', token=token).json()
@myviia_token
def myviia_get_voortgang_deel(object_deel_id: int, token: Optional[str] = None) -> Dict:
"""
Function to collect detailed information from specific object part progress in the MYVIIA webtool.
Input:
- object_deel_id (int): ID of the VIIA object part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a dictionary with the progress information of the requested object part in the MYVIIA webtool.
"""
# Collect the requested image of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/voortgang/{object_deel_id}', token=token).json()
@myviia_token
def myviia_get_spectra(object_id: int, token: Optional[str] = None) -> List:
"""
Function to collect the spectra of a specific object in the MYVIIA webtool.
Input:
- object_id (int): ID of the VIIA object in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a list of all spectra in the MYVIIA webtool for the requested VIIA object. It is expected that the
list contains 4 dictionaries with spectra with the reference periods of 95, 475, 975 and 2475 years.
"""
# Collect the requested image of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/eng_spectra?viiaobjectID={object_id}', token=token).json()
@myviia_token
def myviia_get_eng_measure(object_deel_id: int, token: Optional[str] = None) -> List:
"""
Function to collect the engineering measures of a specific object in the MYVIIA webtool.
Input:
- object_deel_id (int): ID of the VIIA object-part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a list of all measures in the MYVIIA webtool for the requested VIIA object. Each measure is
represented by a dictionary.
"""
# Collect the requested image of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/eng_measure?object_deel_id={object_deel_id}', token=token).json()
@myviia_token
def myviia_get_uo_measure(object_deel_id: int, token: Optional[str] = None) -> List:
"""
Function to collect the uo fase measures of a specific object in the MYVIIA webtool.
Input:
- object_deel_id (int): ID of the VIIA object-part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output:
- Returns a list of all measures in the MYVIIA webtool for the requested VIIA object. Each measure is
represented by a dictionary.
"""
# Collect the requested image of the VIIA object
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/uo_measure?object_deel_id={object_deel_id}', token=token).json()
@myviia_token
def myviia_get_measures_objectpart(object_deel_id: int, token: Optional[str] = None) -> Dict:
"""
This function collects all the retrofitting measures in MYVIIA webtool for the requested objectpart.
Input:
- object_deel_id (int): ID of the VIIA object-part in the MYVIIA webtool.
- token (str): Bearer token for authentication. Use myviia_login function to collect in case of multiple
requests. Default value is None, in which case the login procedure is performed before the actual request to
collect the token for authentication.
Output
- Returns a dictionary with objectpart data with the list of strengthening measures applied in MYVIIA for the
requested objectpart.
"""
# Collect the requested retrofitting measures for the objectpart
return _viia_get_from_myviia(
url=f'{ViiaSettings.MYVIIA_SERVER_URL}/api/object_deel/engMeasure/{object_deel_id}', token=token).json()
### ===================================================================================================================
### 3. Function to collect all required information from MYVIIA
### ===================================================================================================================
@myviia_check_modules
def viia_get_project_information(project: ViiaProject, object_part: str = 'Gehele object') -> bool:
"""
This function will update the project information in the ViiaProject instance with information from the MYVIIA
database.
Input:
- project (obj): VIIA Project object containing collections of fem objects and project variables.
Output:
- The project_information attribute of project instance is updated with all information coupled to the object
in the MYVIIA database.
- Returns True if request was successful.
"""
# Check if token is already present in project
if not project.token:
# Login to MYVIIA webtool for multiple requests
project.token = myviia_login()
# Collect the information of the VIIA objects
viia_objects = myviia_get_all_objects(token=project.token)
# Get the id related to user's object number
object_id = None
for viia_object in viia_objects:
if viia_object['objectnummer_viia'] == project.name:
object_id = viia_object['id']
break
# Check if VIIA object is present
if object_id is None:
raise KeyError(
f"ERROR: The VIIA object '{project.name}' is not recognised or available in MYVIIA database. Please check.")
# Get viia_object data from MYVIIA
viia_object = myviia_get_object(object_id=object_id, token=project.token)
viia_object['objectdelen'] = []
object_parts = myviia_get_objectdelen(object_id=object_id, token=project.token)
if object_parts and 'objectdelen' in object_parts:
for part in object_parts['objectdelen']:
viia_object['objectdelen'].append(
myviia_get_object_part_details(object_part_id=part['id'], token=project.token))
# Find the relevant object-part for the structural assessment
object_part_details = None
for part in viia_object['objectdelen']:
if part['naam'].lower() == object_part.lower():
object_part_details = part
break
if object_part_details is None:
# Object part not recognised
raise ValueError(
f"ERROR: The object-part requested '{object_part}' is not present in the object-parts in the MYVIIA "
f"database. Make sure to select from: "
f"{', '.join([str(part['naam']) for part in viia_object['objectdelen'] ])}.")
# Check if the correct object part is selected in case of multiple object parts
project.project_information['objectdeel'] = object_part_details['naam']
# Store all information of request in the project information
project.project_information.update(**viia_object)
# Adding specific for geotechnical analysis required
if object_part_details['geotechnische_analyse'] is None:
project.project_information['geotechnical_analysis'] = 'Unknown'
elif object_part_details['geotechnische_analyse'] is True:
project.project_information['geotechnical_analysis'] = 'Required'
else:
project.project_information['geotechnical_analysis'] = 'Not required'
# Adding specific for this analysis
project.project_information['gevolgklasse'] = object_part_details['gevolgklasse']
if object_part_details['rekenmethodiek_id'] is None:
project.project_information['analysis_type'] = None
project.project_information['analysis_subtype'] = None
else:
project.project_information['analysis_type'] = object_part_details['rekenmethodiek_id']['rekenmethodiek']
project.project_information['analysis_subtype'] = object_part_details['rekenmethodiek_id']['subtype']
# Adding specific for the inspection
if object_part_details['opnamemethodiek_id'] is None:
project.project_information['inspection_type'] = None
project.project_information['inspection_subtype'] = None
else:
project.project_information['inspection_type'] = object_part_details['opnamemethodiek_id']['opnamemethodiek']
project.project_information['inspection_subtype'] = object_part_details['opnamemethodiek_id']['subtype']
# Check the Basis Of Design
if not ViiaSettings.MYVIIA_REPORT and object_part_details['rekenmethodiek_id']:
if not object_part_details['upr_versie_id']:
raise ValueError(
"ERROR: Before proceeding make sure to fill in the Basis Of Design (UPR) version on MYVIIA")
if 'upr_versie' in object_part_details:
project.project_information['upr'] = object_part_details['upr_versie']
project.write_log(
f"This object will be analysed for consequence class {project.project_information['gevolgklasse']}.",
without_endline=True)
project.write_log(
f"This object will be analysed with PGA (2475y return period) of "
f"{project.project_information['pga']}g,", without_endline=True)
project.write_log(
f" which is based on '{project.project_information['tijdsperiode']}' reference period.",
without_time=True)
# Link dataset to time period
if project.project_information['tijdsperiode'] in ['t1', 't2', 't3']:
project.project_information['dataset'] = 'GMMv5'
elif project.project_information['tijdsperiode'] in ['t4', 't5', 't6']:
project.project_information['dataset'] = 'GMMv6'
else:
project.write_log(f"Dataset for response spectrum with reference period "
f"{project.project_information['tijdsperiode']} was not be recognised.")
# Updating GPS coordinates in 'project.project_information['gps']'
project.project_information['gps']['latitude'] = viia_object['gps_coordinaten_breedtegraad']
project.project_information['gps']['longitude'] = viia_object['gps_coordinaten_lengtegraad']
# Requesting information about object team members
viia_object_team = myviia_get_object_team(object_id=object_id, token=project.token)
# Retrieve the team members and store in project information for team
project.project_information['team'] = viia_object_team['team']
for part in viia_object_team['objectdelen']:
if part['id'] == object_part_details['id']:
project.project_information['team'].update(**part)
# Requesting information about spectra
viia_object_spectra = myviia_get_spectra(object_id=object_id, token=project.token)
# Saving spectra data to project information (handling of data is in other scripts)
if viia_object_spectra:
project.project_information.update({'spectra': viia_object_spectra})
else:
project.write_log("WARNING: No spectra found on MYVIIA. Please check with datatool@viiagroningen.nl.")
# Collecting project information was successful
return True
@myviia_check_modules
def viia_get_project_images(project: ViiaProject, folder_location: Path, report_type: str):
"""
This function will collect the project images from the MYVIIA database.
.. warning:: To prevent mixing of images all png-files are removed from the folder prior to downloading new ones
that are available on MYVIIA.
Input:
- project (obj): VIIA Project object containing collections of fem objects and project variables.
- folder_location (Path): Location where to save the images that are downloaded from MYVIIA. The location should
already exist.
- report_type (str): Type of report for which the images should be downloaded.
Output:
- The requested images are downloaded and saved in the provided folder.
"""
# Check if location is available to store the building images from MYVIIA
if not folder_location.exists():
raise FileNotFoundError("ERROR: The location for the project images does not exist.")
# Clearing images from other objects or earlier downloaded images
for f in [f for f in folder_location.iterdir() if f.suffix == '.png']:
picture = folder_location.parent / f
picture.unlink()
# Getting images (Buildings image, Opname image and Engineering scope image) from myviia
myviia_get_image(
image='building', object_id=project.project_information['id'],
images_folder=folder_location, name='building_image', token=project.token)
myviia_get_image(
image='engineering', object_id=project.project_information['id'],
images_folder=folder_location, name='SCOPE', token=project.token)
myviia_get_image(
image='opname', object_id=project.project_information['id'],
images_folder=folder_location, name='SCOPE_OPNAME', token=project.token)
myviia_get_image(
image='bouwfase', object_id=project.project_information['id'],
images_folder=folder_location, name='FASERING', token=project.token)
myviia_get_image(
image='kadaster', object_id=project.project_information['id'],
images_folder=folder_location, name='KADASTER', token=project.token)
myviia_get_image(
image='situatie', object_id=project.project_information['id'],
images_folder=folder_location, name='SITE_PLAN', token=project.token)
# Find and store inspection information for typology method, if applied
if report_type == 'opname':
image_list = [
x for x in project.project_information['object_deel_opname'].keys()
if 'vraag' in x and 'bestand' in x]
for image_name_ref in image_list:
if project.project_information['object_deel_opname'][image_name_ref]:
image_name = f"{project.project_information['opname_images_folder']}/{image_name_ref}"
myviia_get_opname_image(
image=image_name,
object_deel_opname_id=project.project_information['object_deel_opname']['id'],
images_folder=folder_location, name=image_name_ref.replace('_bestand', ''), token=project.token)
if report_type == 'bevindingen':
image_list = [
x for x in project.project_information['object_deel_bevindingen'].keys()
if 'vraag' in x and 'bestand' in x]
for image_name_ref in image_list:
if project.project_information['object_deel_bevindingen'][image_name_ref]:
image_name = f"{project.project_information['bevindingen_images_folder']}/{image_name_ref}"
myviia_get_opname_image(
image=image_name,
object_deel_opname_id=project.project_information['object_deel_bevindingen']['id'],
images_folder=folder_location, name=image_name_ref.replace('_bestand', ''), token=project.token)
# Find and store information for Beoordelingsrapport
if report_type == 'beoordeling':
# Retrieve facade pictures
if ('object_deel_opname' not in project.project_information or
not project.project_information['object_deel_opname']):
project.write_log(
"WARNING: No inspection found on MYVIIA. Some pictures are not replaced in the "
"Beoordelingsrapport.")
else:
myviia_get_opname_image(
image=f"{project.project_information['opname_images_folder']}/vraag_0_1_bestand",
object_deel_opname_id=project.project_information['object_deel_opname']['id'],
images_folder=folder_location, name='GEVEL_VOOR', token=project.token)
myviia_get_opname_image(
image=f"{project.project_information['opname_images_folder']}/vraag_0_2_bestand",
object_deel_opname_id=project.project_information['object_deel_opname']['id'],
images_folder=folder_location, name='GEVEL_ACHTER', token=project.token)
myviia_get_opname_image(
image=f"{project.project_information['opname_images_folder']}/vraag_0_3_bestand",
object_deel_opname_id=project.project_information['object_deel_opname']['id'],
images_folder=folder_location, name='GEVEL_LINKS', token=project.token)
myviia_get_opname_image(
image=f"{project.project_information['opname_images_folder']}/vraag_0_4_bestand",
object_deel_opname_id=project.project_information['object_deel_opname']['id'],
images_folder=folder_location, name='GEVEL_RECHTS', token=project.token)
### ===================================================================================================================
### 4. End of script
### ===================================================================================================================