Skip to content

Conversation

@bruno-f-cruz
Copy link
Member

@dbirman flagged this issue. I think it should be fixed. If you want to run it for tests without depending on an existing asset use this:

import logging
import tempfile
from pathlib import Path

from aind_data_schema_models.modalities import Modality
from aind_metadata_mapper.gather_metadata import GatherMetadataJob
from aind_metadata_mapper.models import JobSettings

from aind_behavior_vr_foraging.data_mappers import AindRigDataMapper, AindSessionDataMapper
from examples.rig import rig
from examples.session import session
from examples.task_patch_foraging import task_logic

logging.basicConfig(level=logging.INFO)
session_mapped = AindSessionDataMapper(session, rig, task_logic).map()
rig_mapped = AindRigDataMapper(rig).map()

source_metadata_path = "./local/"

session_mapped.write_standard_file(source_metadata_path)
rig_mapped.write_standard_file(source_metadata_path)

output_subfolder = Path(tempfile.mkdtemp(prefix="vr_foraging_test_"))

settings = JobSettings(
    input_metadata_path=str(source_metadata_path),
    output_metadata_path=str(output_subfolder),
    subject_id="828422",
    project_name="Cognitive flexibility in patch foraging",
    modalities=[Modality.BEHAVIOR, Modality.BEHAVIOR_VIDEOS],
)

job = GatherMetadataJob(settings=settings)

job.run_job()

@bruno-f-cruz
Copy link
Member Author

@tiffanyona @dbirman @jasonyslee
We should think about a way to re-run all these mappers. For the rig mapper should be trivial, however, the output of the acquisition mapper needs to be stitched with the current acquisition.json since we have data that is not easy to regenerate (e.g. repository at the state of the experiment acquisition). There are ways to automate it, but we should really think if it is worth doing it versus just sanitizing the json with regex

Copy link
Member

@dbirman dbirman left a comment

Choose a reason for hiding this comment

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

This seems to fix the naming issues that were causing problems before, although without an actual instrument.json and acquisition.json to run through the GatherMetadataJob I can't confirm it for myself. If you were able to run this against a test with the GatherMetadataJob then you should be fine to go forward!

@bruno-f-cruz
Copy link
Member Author

This seems to fix the naming issues that were causing problems before, although without an actual instrument.json and acquisition.json to run through the GatherMetadataJob I can't confirm it for myself. If you were able to run this against a test with the GatherMetadataJob then you should be fine to go forward!

The examples I have in the repo is very close to real metadata. Did you manage to validate the example I sent above?

@dbirman
Copy link
Member

dbirman commented Nov 12, 2025

This seems to fix the naming issues that were causing problems before, although without an actual instrument.json and acquisition.json to run through the GatherMetadataJob I can't confirm it for myself. If you were able to run this against a test with the GatherMetadataJob then you should be fine to go forward!

The examples I have in the repo is very close to real metadata. Did you manage to validate the example I sent above?

Ah sorry I didn't see that the script included code to generate the files. I can take a look tomorrow.

@bruno-f-cruz bruno-f-cruz merged commit e746793 into main Nov 14, 2025
5 checks passed
@bruno-f-cruz bruno-f-cruz deleted the fix-metadata-device-name-generation branch November 14, 2025 18:53
bruno-f-cruz added a commit that referenced this pull request Nov 18, 2025
…nd `acquisition` mappers (#453)

* Ensure names are aligned between mappers

* Fix double import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants