Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ Run the tests:
docker compose up test
```

If you plan to run the tests multiple times, we'd recommend running a shell within the `test` container and—from there—running the tests (as many times as you want). That will also enable syntax highlighting of the test results.

```sh
docker compose run --rm -it test bash

# In the container:
uv run --active pytest -v
```

<details>
<summary>Show/hide FAQ about the ingest script's role in testing</summary>

Expand Down
6 changes: 3 additions & 3 deletions mongodb/ingest_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
import os
import sys
from datetime import datetime
from datetime import datetime, UTC
from typing import Dict, Optional
from schema.datamodel.bertron_schema_pydantic import Entity

Expand Down Expand Up @@ -100,7 +100,7 @@ def insert_entity(self, entity: Dict) -> Optional[str]:
try:
# Add metadata
entity["_metadata"] = {
"ingested_at": datetime.utcnow(),
"ingested_at": datetime.now(UTC),
"schema_version": self.schema.get("version", "unknown"),
}

Expand Down Expand Up @@ -198,7 +198,7 @@ def main():
parser.add_argument("--db-name", default="bertron", help="MongoDB database name")
parser.add_argument(
"--schema-path",
default="https://raw.githubusercontent.com/ber-data/bertron-schema/96cbe257717d44137440be369a8414d153579926/src/schema/jsonschema/bertron_schema.json",
default="https://raw.githubusercontent.com/ber-data/bertron-schema/82498f5f5cbc71ed7abf71b8e2c01d15c003f8d8/src/schema/jsonschema/bertron_schema.json",
help="Path or URL to the BERtron schema JSON file",
)
parser.add_argument(
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ version = "0.0.0"
authors = [
{name = "Chuck Parker", email = "ctparker@lbl.gov"},
]
description = " Cross-BER Data Integration"
description = "Cross-BER Data Integration"
readme = "README.md"
requires-python = ">=3.10.0,<3.14"
dependencies = [
"bertron-schema @ git+https://github.com/ber-data/bertron-schema.git",
# Note: To depend upon the package built from the contents of the _latest commit_
# on the _default branch_ in the `bertron-schema` repository, use:
# ```
# "bertron-schema @ git+https://github.com/ber-data/bertron-schema.git"
# ```
# To depend upon the package built from the contents of a _specific commit_
# in the `bertron-schema` repository, use:
# ```
# "bertron-schema @ git+https://github.com/ber-data/bertron-schema.git@{COMMIT_HASH}"
# ```
# Reference: https://pip.pypa.io/en/stable/topics/vcs-support/
#
"bertron-schema @ git+https://github.com/ber-data/bertron-schema.git@82498f5f5cbc71ed7abf71b8e2c01d15c003f8d8",
# "dtspy @ https://github.com/kbase/dtspy/archive/730828cff3924fc4b2215fe5c1b67bc04aad377f.tar.gz",
"fastapi[standard]>=0.115.12",
# `httpx` is a dependency of FastAPI's `TestClient` class, which we use
Expand Down
4 changes: 2 additions & 2 deletions tests/data/gold-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"altitude": null,
"depth": null,
"elevation": {
"has_numeric_value": 2280,
"has_unit": "meter (UO:0000008)"
"numeric_value": 2280,
"unit": "meter (UO:0000008)"
}
},
"entity_type": [
Expand Down
4 changes: 2 additions & 2 deletions tests/data/monet-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"altitude": null,
"depth": null,
"elevation": {
"has_numeric_value": 722.613,
"has_unit": "unknown"
"numeric_value": 722.613,
"unit": "unknown"
}
},
"entity_type": [
Expand Down
12 changes: 6 additions & 6 deletions tests/data/nmdc-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"longitude": -81.434174,
"altitude": null,
"depth": {
"has_minimum_numeric_value": 0,
"has_maximum_numeric_value": 0.1,
"has_unit": "m",
"has_raw_value": "0 - 0.1m"
"minimum_numeric_value": 0,
"maximum_numeric_value": 0.1,
"unit": "m",
"raw_value": "0 - 0.1m"
},
"elevation": {
"has_numeric_value": 24,
"has_unit": "m"
"numeric_value": 24,
"unit": "m"
}
},
"entity_type": [
Expand Down
18 changes: 9 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.