Skip to content
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

Create metadata table for stored properties #156

Merged
merged 16 commits into from
May 31, 2024
Merged

Create metadata table for stored properties #156

merged 16 commits into from
May 31, 2024

Conversation

lmmentel
Copy link
Owner

@lmmentel lmmentel commented May 21, 2024

The main purpose of this PR is to make properties metadata available alongside actual data so it can be used and referenced.

This is achieved by adding a new model PropertyMetdata with the following columns:

class ValueOrigin(enum.Enum):
    STORED = "stored"
    COMPUTED = "computed"


class PropertyMetadata(Base):
    """Metadata for properties of elements and isotopes."""

    __tablename__ = "propertymetadata"

    id = Column(Integer, primary_key=True)
    annotations = Column(Text)
    attribute_name = Column(String, nullable=False)
    category = Column(String)
    citation_keys = Column(String)
    class_name = Column(String, nullable=False)
    column_name = Column(String, nullable=True)
    description = Column(Text, nullable=False)
    table_name = Column(String, nullable=True)
    unit = Column(String)
    value_origin = Column(Enum(ValueOrigin), nullable=False)
  • add metadata about Element properties to db
  • add metadata about Isotope properties to db
  • update data page in documentation
  • units for properties are now in a format that is compatible with pint

Here is 5 first rows from the new propertymetadata table:

sqlite> SELECT * FROM propertymetadata limit 5;
+----+------------+--------------------+------------+--------------------+------------------------+--------------+--------------------------------+-------+-------------+-------------------+
| id | table_name |    column_name     | class_name |   attribute_name   |        category        | value_origin |          description           | unit  | annotations |   citation_keys   |
+----+------------+--------------------+------------+--------------------+------------------------+--------------+--------------------------------+-------+-------------+-------------------+
| 1  | elements   | abundance_crust    | Element    | abundance_crust    | abundance              | STORED       | Abundance in the Earth's crust | mg/kg |             | haynes2014crc     |
| 2  | elements   | abundance_sea      | Element    | abundance_sea      | abundance              | STORED       | Abundance in the seas          | mg/L  |             | haynes2014crc     |
| 3  | elements   | atomic_number      | Element    | atomic_number      | basic properties       | STORED       | Atomic number                  |       |             |                   |
| 4  | elements   | atomic_radius      | Element    | atomic_radius      | atomic size properties | STORED       | Atomic radius                  | pm    |             | Slater1964        |
| 5  | elements   | atomic_radius_rahm | Element    | atomic_radius_rahm | atomic size properties | STORED       | Atomic radius by Rahm et al.   | pm    |             | Rahm2016,Rahm2017 |
+----+------------+--------------------+------------+--------------------+------------------------+--------------+--------------------------------+-------+-------------+-------------------+

Related issues:

@lmmentel lmmentel added the enhancement New feature or request label May 22, 2024
@lmmentel lmmentel self-assigned this May 22, 2024
@lmmentel lmmentel marked this pull request as ready for review May 23, 2024 17:24
@lmmentel lmmentel merged commit b04a6f0 into master May 31, 2024
20 checks passed
@lmmentel lmmentel deleted the feature/units branch May 31, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant