Skip to content

Add source URLs for material properties - #13

Merged
cmccomb merged 2 commits into
mainfrom
codex/add-source-tag-for-materials-in-issue-#4
Sep 6, 2025
Merged

cmccomb merged 2 commits into
mainfrom
codex/add-source-tag-for-materials-in-issue-#4

Conversation

@cmccomb

@cmccomb cmccomb commented Sep 6, 2025

Copy link
Copy Markdown
Owner

Summary

  • record data provenance for built-in materials via new source field
  • exercise material sources with a dedicated test

Testing

  • ruff check trussme tests
  • mypy trussme/components.py --config-file /tmp/mypy.ini (fails: Missing key "source" for TypedDict "Material" in truss.py and other pre-existing issues)
  • pytest
  • pip-audit

https://chatgpt.com/codex/tasks/task_e_68bcc02ee20083259f085a314b3fd841

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread trussme/components.py
Comment on lines 11 to +20
"density": float,
"elastic_modulus": float,
"yield_strength": float,
"source": str,
},
)
"""TypedDict: New type to contain material properties"""
"""TypedDict: New type to contain material properties.

The ``source`` field stores a URL pointing to the origin of the
mechanical property data for traceability.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Populate source for materials loaded from files

Introducing source as a required key on the Material TypedDict means every Material is now expected to provide provenance information, yet the file readers (read_trs and read_json) still construct material dictionaries with only name, density, elastic modulus, and yield strength. Any truss rebuilt from a .trs or JSON file will therefore produce Material objects without a source, and downstream code that relies on the new field (e.g. material["source"] or re‑serialisation) will raise KeyError or silently drop the provenance after a save/load cycle. Consider defaulting to an empty string or looking up the source from MATERIAL_LIBRARY when creating materials from external data.

Useful? React with 👍 / 👎.

@cmccomb
cmccomb merged commit c6b68db into main Sep 6, 2025
1 check passed
@cmccomb
cmccomb deleted the codex/add-source-tag-for-materials-in-issue-#4 branch September 6, 2025 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant