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

Remove the calculated field index_version #755

Open
yuanzhou opened this issue Mar 5, 2024 · 0 comments
Open

Remove the calculated field index_version #755

yuanzhou opened this issue Mar 5, 2024 · 0 comments
Labels
P Pitt dev team

Comments

@yuanzhou
Copy link
Member

yuanzhou commented Mar 5, 2024

Currently we are adding this index_version as part of the calculated information for EACH entity document. This is totally unnecessary since this field is just the VERSION number and it doesn't reflect the actual deployment (the BUILD number) nor the actual data source (from entity-api).

def add_calculated_fields(self, entity):
logger.info("Start executing add_calculated_fields()")
# Add index_version by parsing the VERSION file
entity['index_version'] = self.index_version

The portal-ui uses both this index_version and their portal translation generated mapper_version (which is more accurate). So supposedly they can just stop referencing this index_version in the portal-ui and we can remove it.

def _get_version():
# Use the generated BUILD (under project root directory) version (git branch name:short commit hash)
# as Elasticsearch mapper_metadata.version
build_path = Path(__file__).absolute(
).parent.parent.parent.parent.parent / 'BUILD'
if build_path.is_file():
# Use strip() to remove leading and trailing spaces, newlines, and tabs
version = build_path.read_text().strip()
logging.debug(f'Read "{version}" from {build_path}')
return version
logging.debug(f'Using place-holder version; No such file: {build_path}')
return 'no-build-file'

@yuanzhou yuanzhou added the P Pitt dev team label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P Pitt dev team
Projects
Status: Backlog
Development

No branches or pull requests

1 participant