Working with Projects
Working with Projects
Projects are a core unit of work inside HUVR. Projects can represent inspections, repairs, surveys or any variety of work. Customers have digitized thousands of different workflows to date.
Projects are buckets of work performed on an Asset by a set of users. Projects can be assigned to crews and a third-party vendor (subcontractor).
The details of the workflow of a project are defined by its Project Type. The contents of the project can handle media files, digital forms (called checklists in our API), structured meta data around inspection Findings, and detailed measurements for flows like Ultrasonic testing (UT).
Finding Existing Projects
The project list endpoint has large number of query parameters. The HUVR UI includes many built in filters to show how to use these filters.
A few examples include:
Show only READY_FOR_REVIEW
or PUBLISHED
projects.
GET /api/projects/?status=READY_FOR_REVIEW,PUBLISHED
Show projects that are READY_FOR_REVIEW
or PUBLISHED
and have the word "Visual" in the name.
GET /api/projects/?status=READY_FOR_REVIEW,PUBLISHED&search=Visual
Creating a Project
To add digital records for work completed in the field, HUVR tracks that data and artifacts in the context of a project. A project has a type called Project Type
. The Project Type defines the specifics of the workflow -- and HUVR services will work with your team to build these details.
Requires:
- Asset
- Project Type
import requests
asset_id = 1 # Asset to connect the project to
project_type_id = 1 # Project type ID
resp = requests.post(f"{HUVR_WORKSPACE_URL}/api/projects/"), json={"name": "Hi this is my first project!", "type": project_type_id, "asset": asset_id })
resp.raise_for_status()
project = resp.json()
See the details in project_create.
Lifecycle of a Project
After a project is created, users typically add data to it and the architecture is setup to enable collaboration on the project from many users.
The project.status
provides an indicator of the project life. Most of the status values are only used as a display value and do not impact the system and operation. However, PUBLISHED
is significant to the system. Once a project is published it is effectively locked and can not be changed.
It is possible to un-publish
a project to make a modification, but this is restricted by a specific permission. All status changes made via the API (and UI) are captured in the Project Status History.
Project Updates
A project object can be updated for most of the attributes. Once a project is created the type
can not be changed.
They can assign it workers via the crews attribute.
requests.patch(f"{HUVR_WORKSPACE_URL}/api/projects/{project_id}/"), json={"crews": [crew1_id, crew2_id]})
Update the description:
requests.patch(f"{HUVR_WORKSPACE_URL}/api/projects/{project_id}/"), json={"description": "Work completed as planned."})
Or even rename it:
requests.patch(f"{HUVR_WORKSPACE_URL}/api/projects/{project_id}/"), json={"name": "Hello World this is my project"})
The real power of the project is the related objects: Inspection Media, Checklists, Defects, and Measurements.
Adding Inspection Media to a Project
Media inside HUVR is typically added in two parts. Once a media file is added, the file is immutable, but the meta data stored in the database can be updated.
To upload a media to project:
import mimetypes
import pathlib
import requests
project_id = 1 # Project ID to upload to
file = pathlib.Path("test-file.png")
media_type, encoding = mimetypes.guess_type(file)
# Creates a Inspection Media object of 0 size, with state of CREATED
resp = requests.post(f"{HUVR_WORKSPACE_URL}/api/inspection-media/"), json={"filename": "my-file.png", "media_type": media_type, "project": project_id })
resp.raise_for_status()
media = resp.json()
# Part 2, send file to cloud
# Response have upload url and headers to be used in next request
upload = media["upload"]
upload_resp = requests.put(
upload["url"], data=open(file, "rb"), headers=upload["headers"]
)
This creates the Inspection Media object with a state of CREATED. The response will provide an upload
object. The upload.url
is a signed URL that gives the client access to PUT to the file directly into Google Cloud Storage.
The response is an Inspection Media object.
After part two is successful, the system will automatically mark the media object as UPLOADED
and do any post processing needed. For image files, this includes generating a thumbnail and preview image. For video files, the HUVR service will transcode the file to web friendly format for playback from the web application.
The upload.url
has a short expiration time period (15 minutes). If the upload is delayed or fails, then the client should get the Inspection Media (GET /api/inspection-media/MEDIA_ID/
) and it will include a newly generated url with a new expiration time.
After a media object is marked UPLOADED
the upload.url
are no longer available in the payload.
Updated over 1 year ago