Skip to content

Add Files (attachment feature) #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop-v2
Choose a base branch
from

Conversation

JieXiong9119
Copy link
Contributor

@JieXiong9119 JieXiong9119 commented Apr 17, 2025

Any background context you want to provide?

This PR was motivated by both the feature request in this ticket, and one of the proposed (possible) solutions of addressing complex mapping with Std 229P.

What does this PR do?

See proposal

How should this be manually tested?

TO DO

What are the relevant tickets?

#391 #514

Screenshots (if appropriate)

@JieXiong9119 JieXiong9119 added DO NOT MERGE Schema: General General update to BuildingSync Non-breaking Change feature Adding new functionality to BuildingSync labels Apr 17, 2025
@JieXiong9119 JieXiong9119 self-assigned this Apr 17, 2025
@JieXiong9119 JieXiong9119 changed the title Add Files Add Files (attachment feature) Apr 17, 2025
@markborkum
Copy link
Contributor

We should think about how files are linked to premises, systems, measures, etc. Perhaps, auc:File/auc:LinkedPremises and/or auc:File/auc:LinkedSystemIDs child elements.

An example use case is photographs of buildings, pieces of equipment, deficiencies that are addressed by measures.

@JieXiong9119 JieXiong9119 requested a review from haneslinger May 7, 2025 16:52
@haneslinger
Copy link
Contributor

It would be rather helpful to me if the proposal contained a little snippet of what this would look like in a real buildingsync file. Is it like this?

<auc:Building ID="Building-1">
  <!-- ... -->
  <auc:Files>
    <auc:File ID="File-1">
      <auc:FileName>north.png</auc:FileName>
      <auc:FileDescription>View of north face of building</auc:FileDescription>
      <auc:FileContentType>image/png</auc:FileContentType>
      <auc:FileSize>1024</auc:FileSize>
      <auc:FileSHA1Checksum>2fd4e1c67a2d28fced849ee1bb76e7391b93eb12</auc:FileSHA1Checksum>
      <auc:FileURL>https://www.example.com/buildings/1/north.png</auc:FileURL>
    </auc:File>
  </auc:Files>
  <!-- ... -->
</auc:Building>

@JieXiong9119
Copy link
Contributor Author

JieXiong9119 commented May 8, 2025

It would be rather helpful to me if the proposal contained a little snippet of what this would look like in a real buildingsync file. Is it like this?

<auc:Building ID="Building-1">
  <!-- ... -->
  <auc:Files>
    <auc:File ID="File-1">
      <auc:FileName>north.png</auc:FileName>
      <auc:FileDescription>View of north face of building</auc:FileDescription>
      <auc:FileContentType>image/png</auc:FileContentType>
      <auc:FileSize>1024</auc:FileSize>
      <auc:FileSHA1Checksum>2fd4e1c67a2d28fced849ee1bb76e7391b93eb12</auc:FileSHA1Checksum>
      <auc:FileURL>https://www.example.com/buildings/1/north.png</auc:FileURL>
    </auc:File>
  </auc:Files>
  <!-- ... -->
</auc:Building>

Pretty close, but tweaking a bit to use the linking element like this:

<auc:Facility ID="Facility-1">
  <auc:Sites>
    <auc:Site ID="Site-1">
      <auc:Buildings>
        <auc:Building>
          <!-- ... -->
          <auc:LinkedFiles>
            <auc:LinkedFileID IDref="File-1"/>
          </auc:LinkedFiles>
        </auc:Building>
      </auc:Buildings>
    </auc:Site>
  </auc:Sites>
  <!-- ... -->
  <auc:Files>
    <auc:File ID="File-1">
      <auc:FileName>north.png</auc:FileName>
      <auc:FileDescription>View of north face of building</auc:FileDescription>
      <auc:FileContentType>image/png</auc:FileContentType>
      <auc:FileSize>1024</auc:FileSize>
      <auc:FileSHA1Checksum>2fd4e1c67a2d28fced849ee1bb76e7391b93eb12</auc:FileSHA1Checksum>
      <auc:FileURL>https://www.example.com/buildings/1/north.png</auc:FileURL>
    </auc:File>
  </auc:Files>
  <!-- ... -->
</auc:Facility>

I have not got to update the linking element implementation part, but yes I will create an example xml in the end after I finish all the updates in the schema.

Copy link
Contributor

@ThibaultMarzullo ThibaultMarzullo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good Jie!

@JieXiong9119
Copy link
Contributor Author

We should think about how files are linked to premises, systems, measures, etc. Perhaps, auc:File/auc:LinkedPremises and/or auc:File/auc:LinkedSystemIDs child elements.

An example use case is photographs of buildings, pieces of equipment, deficiencies that are addressed by measures.

It's a question I have - should we link file within a premise, or link a premise under a file (like you suggested)?

@JieXiong9119 JieXiong9119 requested a review from markborkum May 29, 2025 20:27
@JieXiong9119
Copy link
Contributor Author

@markborkum I added the linking elements for the Files to the locations where I think applicable. Would you please review the changes again and let me know your opinions? Thanks.

BuildingSync.xsd Outdated
</xs:element>
<xs:element name="FileSize" type="xs:integer" minOccurs="0">
<xs:annotation>
<xs:documentation>Size of file in Megabyte (MB)</xs:documentation>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file size is relatively small, then the rounded size in megabytes would be 0. Consider replacing this with the size in bytes.

Also, since file sizes cannot be negative, should this be xs:nonNegativeInteger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense! Updated.

BuildingSync.xsd Outdated
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\w+/[-+.\w]+"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using \w+/[-.\w]+(?:\+[-.\w]+)? to validate that there is only 1 component after the + symbol.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried your suggestion but it seems that XSD does not support such advanced expression. I substitute with \w+/([-.\w]+|\w+[-.\w]*\+[-.\w]+) to flatten the pattern. Let me know if this looks right to you - I'm totally new to regex thingy.

@JieXiong9119 JieXiong9119 requested a review from markborkum June 4, 2025 16:23
Copy link
Contributor

@markborkum markborkum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for addressing my comments, @JieXiong9119.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE feature Adding new functionality to BuildingSync Non-breaking Change Schema: General General update to BuildingSync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants