Skip to content

Commit a098648

Browse files
authored
Merge pull request #194 from brain-image-library/fix/db-connection
bug/metadata-ingesting
2 parents 73052b4 + faeb8ec commit a098648

File tree

4 files changed

+120
-119
lines changed

4 files changed

+120
-119
lines changed

bil_site/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
'NAME': config['Security']['DATABASE_NAME'],
138138
'USER': config['Security']['DATABASE_USER'],
139139
'PASSWORD': DATABASE_PASSWORD,
140-
#'HOST': 'localhost',
141140
'HOST': config['Security']['DB_HOST'],
142141
'PORT': '',
143142
}

example.cfg

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[Security]
22
# Change secret key!!!
33
# python manage.py shell -c 'from django.core.management import utils; print(utils.get_random_secret_key())'
4-
#SECRET_KEY = top_secret_key
4+
SECRET_KEY = top_secret_key
55
DEBUG = yes
6-
FAKE_STORAGE_AREA = yes
6+
FAKE_STORAGE_AREA = no
77
# Use "DATABASE = postgres" in production
8-
DATABASE = sqlite
8+
DATABASE = postgres
99
# Change DATABASE_PASSWORD if using 'DATABASE = postgres'!!!
10-
#DATABASE_PASSWORD = top_secret_database_password
10+
DATABASE_PASSWORD = top_secret_database_password
11+
DB_HOST = localhost
1112
STAGING_AREA_ROOT = /bil/lz
1213
IMG_DATA_HOST = dxc.psc.edu
14+
EMAIL_USER = '[email protected]'
15+
EMAIL_PASSWORD = 'very_secret_email_password'

ingest/views.py

Lines changed: 112 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,15 +1460,15 @@ def save_contributors_sheet(contributors, sheet):
14601460
# saved_contributors = []
14611461
try:
14621462
for c in contributors:
1463-
contributorname = c['contributorName'].lower()
1464-
creator = c['Creator'].lower()
1465-
contributortype = c['contributorType'].lower()
1466-
nametype = c['nameType'].lower()
1467-
nameidentifier = c['nameIdentifier'].lower()
1468-
nameidentifierscheme = c['nameIdentifierScheme'].lower()
1469-
affiliation = c['affiliation'].lower()
1470-
affiliationidentifier = c['affiliationIdentifier'].lower()
1471-
affiliationidentifierscheme = c['affiliationIdentifierScheme'].lower()
1463+
contributorname = c['contributorName']
1464+
creator = c['Creator']
1465+
contributortype = c['contributorType']
1466+
nametype = c['nameType']
1467+
nameidentifier = c['nameIdentifier']
1468+
nameidentifierscheme = c['nameIdentifierScheme']
1469+
affiliation = c['affiliation']
1470+
affiliationidentifier = c['affiliationIdentifier']
1471+
affiliationidentifierscheme = c['affiliationIdentifierScheme']
14721472

14731473
contributor = Contributor(contributorname=contributorname, creator=creator, contributortype=contributortype, nametype=nametype, nameidentifier=nameidentifier, nameidentifierscheme=nameidentifierscheme, affiliation=affiliation, affiliationidentifier=affiliationidentifier, affiliationidentifierscheme=affiliationidentifierscheme, sheet_id=sheet.id)
14741474
contributor.save()
@@ -1483,11 +1483,11 @@ def save_contributors_sheet(contributors, sheet):
14831483
def save_funders_sheet(funders, sheet):
14841484
try:
14851485
for f in funders:
1486-
fundername = f['funderName'].lower()
1487-
funding_reference_identifier = f['fundingReferenceIdentifier'].lower()
1488-
funding_reference_identifier_type = f['fundingReferenceIdentifierType'].lower()
1489-
award_number = f['awardNumber'].lower()
1490-
award_title = f['awardTitle'].lower()
1486+
fundername = f['funderName']
1487+
funding_reference_identifier = f['fundingReferenceIdentifier']
1488+
funding_reference_identifier_type = f['fundingReferenceIdentifierType']
1489+
award_number = f['awardNumber']
1490+
award_title = f['awardTitle']
14911491

14921492
funder = Funder(fundername=fundername, funding_reference_identifier=funding_reference_identifier, funding_reference_identifier_type=funding_reference_identifier_type, award_number=award_number, award_title=award_title, sheet_id=sheet.id)
14931493
funder.save()
@@ -1499,11 +1499,11 @@ def save_funders_sheet(funders, sheet):
14991499
def save_publication_sheet(publications, sheet):
15001500
try:
15011501
for p in publications:
1502-
relatedidentifier = p['relatedIdentifier'].lower()
1503-
relatedidentifiertype = p['relatedIdentifierType'].lower()
1504-
pmcid = p['PMCID'].lower()
1505-
relationtype = p['relationType'].lower()
1506-
citation = p['citation'].lower()
1502+
relatedidentifier = p['relatedIdentifier']
1503+
relatedidentifiertype = p['relatedIdentifierType']
1504+
pmcid = p['PMCID']
1505+
relationtype = p['relationType']
1506+
citation = p['citation']
15071507

15081508
publication = Publication(relatedidentifier=relatedidentifier, relatedidentifiertype=relatedidentifiertype, pmcid=pmcid, relationtype=relationtype, citation=citation, sheet_id=sheet.id)
15091509
publication.save()
@@ -1516,18 +1516,18 @@ def save_instrument_sheet_method_1(instruments, sheet):
15161516
# there should be 1 line in the instrument tab for methods 1, 2, 3
15171517
try:
15181518
for i in instruments:
1519-
microscopetype = i['MicroscopeType'].lower()
1520-
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel'].lower()
1521-
objectivename = i['ObjectiveName'].lower()
1522-
objectiveimmersion = i['ObjectiveImmersion'].lower()
1523-
objectivena = i['ObjectiveNA'].lower()
1524-
objectivemagnification = i['ObjectiveMagnification'].lower()
1525-
detectortype = i['DetectorType'].lower()
1526-
detectormodel = i['DetectorModel'].lower()
1527-
illuminationtypes = i['IlluminationTypes'].lower()
1528-
illuminationwavelength = i['IlluminationWavelength'].lower()
1529-
detectionwavelength = i['DetectionWavelength'].lower()
1530-
sampletemperature = i['SampleTemperature'].lower()
1519+
microscopetype = i['MicroscopeType']
1520+
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel']
1521+
objectivename = i['ObjectiveName']
1522+
objectiveimmersion = i['ObjectiveImmersion']
1523+
objectivena = i['ObjectiveNA']
1524+
objectivemagnification = i['ObjectiveMagnification']
1525+
detectortype = i['DetectorType']
1526+
detectormodel = i['DetectorModel']
1527+
illuminationtypes = i['IlluminationTypes']
1528+
illuminationwavelength = i['IlluminationWavelength']
1529+
detectionwavelength = i['DetectionWavelength']
1530+
sampletemperature = i['SampleTemperature']
15311531

15321532
instrument = Instrument(microscopetype=microscopetype, microscopemanufacturerandmodel=microscopemanufacturerandmodel, objectivename=objectivename, objectiveimmersion=objectiveimmersion, objectivena=objectivena, objectivemagnification=objectivemagnification, detectortype=detectortype, detectormodel=detectormodel, illuminationtypes=illuminationtypes, illuminationwavelength=illuminationwavelength, detectionwavelength=detectionwavelength, sampletemperature=sampletemperature, sheet_id=sheet.id)
15331533
instrument.save()
@@ -1540,18 +1540,18 @@ def save_instrument_sheet_method_2(instruments, sheet):
15401540
# there should be 1 line in the instrument tab for methods 1, 2, 3
15411541
try:
15421542
for i in instruments:
1543-
microscopetype = i['MicroscopeType'].lower()
1544-
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel'].lower()
1545-
objectivename = i['ObjectiveName'].lower()
1546-
objectiveimmersion = i['ObjectiveImmersion'].lower()
1547-
objectivena = i['ObjectiveNA'].lower()
1548-
objectivemagnification = i['ObjectiveMagnification'].lower()
1549-
detectortype = i['DetectorType'].lower()
1550-
detectormodel = i['DetectorModel'].lower()
1551-
illuminationtypes = i['IlluminationTypes'].lower()
1552-
illuminationwavelength = i['IlluminationWavelength'].lower()
1553-
detectionwavelength = i['DetectionWavelength'].lower()
1554-
sampletemperature = i['SampleTemperature'].lower()
1543+
microscopetype = i['MicroscopeType']
1544+
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel']
1545+
objectivename = i['ObjectiveName']
1546+
objectiveimmersion = i['ObjectiveImmersion']
1547+
objectivena = i['ObjectiveNA']
1548+
objectivemagnification = i['ObjectiveMagnification']
1549+
detectortype = i['DetectorType']
1550+
detectormodel = i['DetectorModel']
1551+
illuminationtypes = i['IlluminationTypes']
1552+
illuminationwavelength = i['IlluminationWavelength']
1553+
detectionwavelength = i['DetectionWavelength']
1554+
sampletemperature = i['SampleTemperature']
15551555

15561556
instrument = Instrument(microscopetype=microscopetype, microscopemanufacturerandmodel=microscopemanufacturerandmodel, objectivename=objectivename, objectiveimmersion=objectiveimmersion, objectivena=objectivena, objectivemagnification=objectivemagnification, detectortype=detectortype, detectormodel=detectormodel, illuminationtypes=illuminationtypes, illuminationwavelength=illuminationwavelength, detectionwavelength=detectionwavelength, sampletemperature=sampletemperature, sheet_id=sheet.id)
15571557
instrument.save()
@@ -1564,18 +1564,18 @@ def save_instrument_sheet_method_3(instruments, sheet):
15641564
# there should be 1 line in the instrument tab for methods 1, 2, 3
15651565
try:
15661566
for i in instruments:
1567-
microscopetype = i['MicroscopeType'].lower()
1568-
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel'].lower()
1569-
objectivename = i['ObjectiveName'].lower()
1570-
objectiveimmersion = i['ObjectiveImmersion'].lower()
1571-
objectivena = i['ObjectiveNA'].lower()
1572-
objectivemagnification = i['ObjectiveMagnification'].lower()
1573-
detectortype = i['DetectorType'].lower()
1574-
detectormodel = i['DetectorModel'].lower()
1575-
illuminationtypes = i['IlluminationTypes'].lower()
1576-
illuminationwavelength = i['IlluminationWavelength'].lower()
1577-
detectionwavelength = i['DetectionWavelength'].lower()
1578-
sampletemperature = i['SampleTemperature'].lower()
1567+
microscopetype = i['MicroscopeType']
1568+
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel']
1569+
objectivename = i['ObjectiveName']
1570+
objectiveimmersion = i['ObjectiveImmersion']
1571+
objectivena = i['ObjectiveNA']
1572+
objectivemagnification = i['ObjectiveMagnification']
1573+
detectortype = i['DetectorType']
1574+
detectormodel = i['DetectorModel']
1575+
illuminationtypes = i['IlluminationTypes']
1576+
illuminationwavelength = i['IlluminationWavelength']
1577+
detectionwavelength = i['DetectionWavelength']
1578+
sampletemperature = i['SampleTemperature']
15791579

15801580
instrument = Instrument(microscopetype=microscopetype, microscopemanufacturerandmodel=microscopemanufacturerandmodel, objectivename=objectivename, objectiveimmersion=objectiveimmersion, objectivena=objectivena, objectivemagnification=objectivemagnification, detectortype=detectortype, detectormodel=detectormodel, illuminationtypes=illuminationtypes, illuminationwavelength=illuminationwavelength, detectionwavelength=detectionwavelength, sampletemperature=sampletemperature, sheet_id=sheet.id)
15811581
instrument.save()
@@ -1591,18 +1591,18 @@ def save_instrument_sheet_method_4(instruments, sheet, saved_datasets):
15911591
data_set_id = d.id
15921592

15931593
i = instruments[d_index]
1594-
microscopetype = i['MicroscopeType'].lower()
1595-
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel'].lower()
1596-
objectivename = i['ObjectiveName'].lower()
1597-
objectiveimmersion = i['ObjectiveImmersion'].lower()
1598-
objectivena = i['ObjectiveNA'].lower()
1599-
objectivemagnification = i['ObjectiveMagnification'].lower()
1600-
detectortype = i['DetectorType'].lower()
1601-
detectormodel = i['DetectorModel'].lower()
1602-
illuminationtypes = i['IlluminationTypes'].lower()
1603-
illuminationwavelength = i['IlluminationWavelength'].lower()
1604-
detectionwavelength = i['DetectionWavelength'].lower()
1605-
sampletemperature = i['SampleTemperature'].lower()
1594+
microscopetype = i['MicroscopeType']
1595+
microscopemanufacturerandmodel = i['MicroscopeManufacturerAndModel']
1596+
objectivename = i['ObjectiveName']
1597+
objectiveimmersion = i['ObjectiveImmersion']
1598+
objectivena = i['ObjectiveNA']
1599+
objectivemagnification = i['ObjectiveMagnification']
1600+
detectortype = i['DetectorType']
1601+
detectormodel = i['DetectorModel']
1602+
illuminationtypes = i['IlluminationTypes']
1603+
illuminationwavelength = i['IlluminationWavelength']
1604+
detectionwavelength = i['DetectionWavelength']
1605+
sampletemperature = i['SampleTemperature']
16061606

16071607
instrument = Instrument(microscopetype=microscopetype, microscopemanufacturerandmodel=microscopemanufacturerandmodel, objectivename=objectivename, objectiveimmersion=objectiveimmersion, objectivena=objectivena, objectivemagnification=objectivemagnification, detectortype=detectortype, detectormodel=detectormodel, illuminationtypes=illuminationtypes, illuminationwavelength=illuminationwavelength, detectionwavelength=detectionwavelength, sampletemperature=sampletemperature, data_set_id=data_set_id, sheet_id=sheet.id)
16081608
instrument.save()
@@ -1615,21 +1615,21 @@ def save_dataset_sheet_method_1_or_3(datasets, sheet):
16151615
saved_datasets = []
16161616
try:
16171617
for d in datasets:
1618-
bildirectory = d['BILDirectory'].lower()
1619-
title = d['title'].lower()
1620-
socialmedia = d['socialMedia'].lower()
1621-
subject = d['subject'].lower()
1622-
subjectscheme = d['Subjectscheme'].lower()
1623-
rights = d['rights'].lower()
1624-
rightsuri = d['rightsURI'].lower()
1625-
rightsidentifier = d['rightsIdentifier'].lower()
1626-
dataset_image = d['Image'].lower()
1627-
generalmodality = d['GeneralModality'].lower()
1628-
technique = d['Technique'].lower()
1629-
other = d['Other'].lower()
1630-
abstract = d['Abstract'].lower()
1631-
methods = d['Methods'].lower()
1632-
technicalinfo = d['TechnicalInfo'].lower()
1618+
bildirectory = d['BILDirectory']
1619+
title = d['title']
1620+
socialmedia = d['socialMedia']
1621+
subject = d['subject']
1622+
subjectscheme = d['Subjectscheme']
1623+
rights = d['rights']
1624+
rightsuri = d['rightsURI']
1625+
rightsidentifier = d['rightsIdentifier']
1626+
dataset_image = d['Image']
1627+
generalmodality = d['GeneralModality']
1628+
technique = d['Technique']
1629+
other = d['Other']
1630+
abstract = d['Abstract']
1631+
methods = d['Methods']
1632+
technicalinfo = d['TechnicalInfo']
16331633

16341634
dataset = Dataset(bildirectory=bildirectory, title=title, socialmedia=socialmedia, subject=subject, subjectscheme=subjectscheme, rights=rights, rightsuri=rightsuri, rightsidentifier=rightsidentifier, dataset_image=dataset_image, generalmodality=generalmodality, technique=technique, other=other, abstract=abstract, methods=methods, technicalinfo=technicalinfo, sheet_id=sheet.id)
16351635
dataset.save()
@@ -1643,21 +1643,21 @@ def save_dataset_sheet_method_2(datasets, sheet):
16431643
# only 1 dataset row expected here
16441644
try:
16451645
for d in datasets:
1646-
bildirectory = d['BILDirectory'].lower()
1647-
title = d['title'].lower()
1648-
socialmedia = d['socialMedia'].lower()
1649-
subject = d['subject'].lower()
1650-
subjectscheme = d['Subjectscheme'].lower()
1651-
rights = d['rights'].lower()
1652-
rightsuri = d['rightsURI'].lower()
1653-
rightsidentifier = d['rightsIdentifier'].lower()
1654-
dataset_image = d['Image'].lower()
1655-
generalmodality = d['GeneralModality'].lower()
1656-
technique = d['Technique'].lower()
1657-
other = d['Other'].lower()
1658-
abstract = d['Abstract'].lower()
1659-
methods = d['Methods'].lower()
1660-
technicalinfo = d['TechnicalInfo'].lower()
1646+
bildirectory = d['BILDirectory']
1647+
title = d['title']
1648+
socialmedia = d['socialMedia']
1649+
subject = d['subject']
1650+
subjectscheme = d['Subjectscheme']
1651+
rights = d['rights']
1652+
rightsuri = d['rightsURI']
1653+
rightsidentifier = d['rightsIdentifier']
1654+
dataset_image = d['Image']
1655+
generalmodality = d['GeneralModality']
1656+
technique = d['Technique']
1657+
other = d['Other']
1658+
abstract = d['Abstract']
1659+
methods = d['Methods']
1660+
technicalinfo = d['TechnicalInfo']
16611661

16621662
dataset = Dataset(bildirectory=bildirectory, title=title, socialmedia=socialmedia, subject=subject, subjectscheme=subjectscheme, rights=rights, rightsuri=rightsuri, rightsidentifier=rightsidentifier, dataset_image=dataset_image, generalmodality=generalmodality, technique=technique, other=other, abstract=abstract, methods=methods, technicalinfo=technicalinfo, sheet_id=sheet.id)
16631663
dataset.save()
@@ -1673,21 +1673,21 @@ def save_dataset_sheet_method_4(datasets, sheet, specimen_object_method_4):
16731673
saved_datasets = []
16741674
try:
16751675
for d in datasets:
1676-
bildirectory = d['BILDirectory'].lower()
1677-
title = d['title'].lower()
1678-
socialmedia = d['socialMedia'].lower()
1679-
subject = d['subject'].lower()
1680-
subjectscheme = d['Subjectscheme'].lower()
1681-
rights = d['rights'].lower()
1682-
rightsuri = d['rightsURI'].lower()
1683-
rightsidentifier = d['rightsIdentifier'].lower()
1684-
dataset_image = d['Image'].lower()
1685-
generalmodality = d['GeneralModality'].lower()
1686-
technique = d['Technique'].lower()
1687-
other = d['Other'].lower()
1688-
abstract = d['Abstract'].lower()
1689-
methods = d['Methods'].lower()
1690-
technicalinfo = d['TechnicalInfo'].lower()
1676+
bildirectory = d['BILDirectory']
1677+
title = d['title']
1678+
socialmedia = d['socialMedia']
1679+
subject = d['subject']
1680+
subjectscheme = d['Subjectscheme']
1681+
rights = d['rights']
1682+
rightsuri = d['rightsURI']
1683+
rightsidentifier = d['rightsIdentifier']
1684+
dataset_image = d['Image']
1685+
generalmodality = d['GeneralModality']
1686+
technique = d['Technique']
1687+
other = d['Other']
1688+
abstract = d['Abstract']
1689+
methods = d['Methods']
1690+
technicalinfo = d['TechnicalInfo']
16911691

16921692
dataset = Dataset(bildirectory=bildirectory, title=title, socialmedia=socialmedia, subject=subject, subjectscheme=subjectscheme, rights=rights, rightsuri=rightsuri, rightsidentifier=rightsidentifier, dataset_image=dataset_image, generalmodality=generalmodality, technique=technique, other=other, abstract=abstract, methods=methods, technicalinfo=technicalinfo, sheet_id=sheet.id, specimen_ingest_method_4=specimen_ingest_method_4)
16931693

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ paramiko==2.10.1
3333
pretty-dump==3.0
3434
prompt-toolkit==3.0.24
3535
psycopg==3.0.11
36-
psycopg2-binary==2.9.1
37-
pyasn1==0.4.3
36+
pyasn1==0.4.6
3837
pycparser==2.18
3938
pyexcel==0.5.8
4039
pyexcel-ezodf==0.3.4

0 commit comments

Comments
 (0)