Skip to content

Commit

Permalink
-> Re-enable seed-pull
Browse files Browse the repository at this point in the history
  • Loading branch information
s-paquette committed Feb 21, 2020
1 parent 6f91c80 commit a6e33c7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
1 change: 0 additions & 1 deletion idc/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def get_collex_metadata(filters, fields, with_docs=True, record_limit=10, counts
'query_string': "*:*",
'facets': solr_facets,
'limit': record_limit if with_docs else 0,
# what is with_docs supposed to do?? 'limit': 10 if with_docs else 0,
'collapse_on': 'SeriesInstanceUID',
'counts_only': counts_only
})
Expand Down
3 changes: 2 additions & 1 deletion idc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def explore_data(request):
context = {}
try:
# These are example filters; typically they will be reconstituted from the request
filters = {"vital_status": ["Alive", "Dead"], "age_at_diagnosis_btw": [15,40], "bmi": "underweight"}
filters = {"vital_status": ["Alive", "Dead"], "age_at_diagnosis_btw": [15,40], "bmi": "underweight", "race": "BLACK OR AFRICAN AMERICAN"}
# These are the actual data fields to display in the expanding table; again this is just an example
# set that should be properly supplied in the reuqest
fields = ["BodyPartExamined", "Modality", "StudyDescription", "StudyInstanceUID", "SeriesInstanceUID"]
Expand All @@ -139,6 +139,7 @@ def explore_data(request):
'cross_collex_attr_counts': facets_and_lists['facets']['cross_collex'],
'listings': facets_and_lists['docs']
}

except Exception as e:
logger.error("[ERROR] In explore_data:")
logger.exception(e)
Expand Down
22 changes: 11 additions & 11 deletions scripts/database_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import django
django.setup()

from idc_collections.models import Program, Collection, Attribute, Attribute_Display_Values, SolrCollection, BigQueryTable, DataVersion
from idc_collections.models import Program, Collection, Attribute, Attribute_Ranges, Attribute_Display_Values, SolrCollection, BigQueryTable, DataVersion

from django.contrib.auth.models import User
idc_superuser = User.objects.get(username="idc")
Expand Down Expand Up @@ -165,6 +165,10 @@ def add_attributes(attr_set):
preformatted_values=True if 'preformatted_values' in attr else False,
is_cross_collex=True if 'cross_collex' in attr else False
)
if 'range' in attr:
Attribute_Ranges.objects.update_or_create(
attribute=obj
)
if 'display_vals' in attr:
for dv in attr['display_vals']:
Attribute_Display_Values.objects.update_or_create(
Expand Down Expand Up @@ -288,6 +292,9 @@ def main():
else:
attr['display_vals'] = display_vals[attr['name']]['vals']

if attr['name'] == "age_at_diagnosis":
attr['range'] = True

attr_set.append(attr)

attr_file.close()
Expand All @@ -299,23 +306,16 @@ def main():
line = line.strip()
line_split = line.split(",")

attr_set.append({
attr = {
'name': line_split[0],
"display_name": line_split[0].replace("_", " ").title() if re.search(r'_', line_split[1]) else line_split[1],
"type": Attribute.CATEGORICAL if line_split[2] == 'CATEGORICAL STRING' else Attribute.STRING if line_split[2] == "STRING" else Attribute.CONTINUOUS_NUMERIC,
'cross_collex': True,
'solr_collex': ['tcia_images'],
'bq_tables': ["idc-dev-etl.tcia.dicom_metadata"]
})
}

attr_set.append({
'name': 'collection_id',
'display_name': "Collection",
"type": Attribute.CATEGORICAL,
"cross_collex": True,
'solr_collex': ['tcia_images'],
'bq_tables': ["idc-dev-etl.tcia.dicom_metadata"]
})
attr_set.append(attr)

add_attributes(attr_set)

Expand Down
2 changes: 1 addition & 1 deletion shell/database-refresh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else
exit 1
fi
# Doublecheck where we're running this...
if [ $DATABASE_HOST != "localhost" ]; then
if [ "${DATABASE_HOST}" != "localhost" ]; then
echo "[ERROR] Possible remote database detected! This script IS ONLY intended for use on local developer builds!"
echo "[ERROR] Host seen: ${DATABASE_HOST}"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion shell/python-su.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
sudo PYTHONPATH="$PYTHONPATH" SECURE_LOCAL_PATH="$SECURE_LOCAL_PATH" /usr/bin/python3 "$@"
sudo PYTHONPATH="$VM_PYTHONPATH" SECURE_LOCAL_PATH="$SECURE_LOCAL_PATH" /usr/bin/python3 "$@"

0 comments on commit a6e33c7

Please sign in to comment.