Skip to content

Commit

Permalink
Merge pull request #180 from sennetconsortium/libpitt/cedar-support
Browse files Browse the repository at this point in the history
Libpitt/cedar support
  • Loading branch information
maxsibilla authored Oct 24, 2023
2 parents 23c90e5 + 6c02438 commit a1e3438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/instance/app.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ DATACITE_SENNET_PREFIX = ''
UBKG_SERVER = 'https://ontology.api.hubmapconsortium.org/'
UBKG_ENDPOINT_VALUESET = 'valueset?parent_sab=SENNET&parent_code={code}&child_sabs=SENNET'
UBKG_CODES = '{"specimen_categories":"C020076", "organ_types":{"code": "C000008", "key": "organs", "endpoint": "organs?application_context=SENNET"}, "entities": "C000012", "source_types":"C050020", "assay_types":{"code": "C004000", "key": "datasets", "endpoint": "datasets?application_context=SENNET"}}'

# CEDAR API KEY, get one at: https://cedar.metadatacenter.org/
CEDAR_API_KEY = ''
9 changes: 8 additions & 1 deletion src/routes/validation/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import time
import csv

from ..privs import get_groups_token

validation_blueprint = Blueprint('validation', __name__)
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -105,7 +107,12 @@ def validate_tsv(schema='metadata', path=None):
result = {'Preflight': str(e)}
else:
try:
result = iv_utils.get_tsv_errors(path, schema_name=schema_name, report_type=table_validator.ReportType.JSON)
app_context = {
'request_header': {'X-SenNet-Application': 'ingest-api'},
'entities_url': f"{commons_file_helper.ensureTrailingSlashURL(current_app.config['ENTITY_WEBSERVICE_URL'])}entities/"
}
result = iv_utils.get_tsv_errors(path, schema_name=schema_name, report_type=table_validator.ReportType.JSON,
cedar_api_key=current_app.config['CEDAR_API_KEY'], globus_token=get_groups_token(), app_context=app_context)
except Exception as e:
result = rest_server_err(e, True)
return json.dumps(result)
Expand Down

0 comments on commit a1e3438

Please sign in to comment.