Skip to content

Commit

Permalink
replace all biospecdb -> biodb
Browse files Browse the repository at this point in the history
Signed-off-by: James Noss <[email protected]>
  • Loading branch information
jamienoss committed May 29, 2024
1 parent da6de04 commit 049a0db
Show file tree
Hide file tree
Showing 53 changed files with 140 additions and 140 deletions.
8 changes: 4 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ omit =
*/migrations/*
manage.py
_version.py
biospecdb/apps/dash/*
biospecdb/asgi.py
biospecdb/wsgi.py
biospecdb/settings/*
biodb/apps/dash/*
biodb/asgi.py
biodb/wsgi.py
biodb/settings/*
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ authors:
- family-names: "Mitschang"
given-names: "Arik"
orcid: "https://orcid.org/0000-0001-9239-012X"
title: "BioSpecDB"
title: "biodb"
doi: "10048241"
url: "https://github.com/rispadd/biospecdb"
url: "https://github.com/rispadd/biodb"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY requirements/prd.txt /app/requirements.txt
RUN pip3 install -r requirements.txt

COPY manage.py /app/
COPY biospecdb/ /app/biospecdb/
COPY biodb/ /app/biodb/
COPY config/ /app/config/

CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SSEC-JHU BioSpecDB
# SSEC-JHU biodb

[![CI](https://github.com/rispadd/biospecdb/actions/workflows/ci.yml/badge.svg)](https://github.com/rispadd/biospecdb/actions/workflows/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/biospecdb/badge/?version=latest)](https://biospecdb.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/RISPaDD/biospecdb/graph/badge.svg?token=Ld95EDCYNZ)](https://codecov.io/gh/RISPaDD/biospecdb)
[![Security](https://github.com/rispadd/biospecdb/actions/workflows/security.yml/badge.svg)](https://github.com/rispadd/biospecdb/actions/workflows/security.yml)
[![CI](https://github.com/rispadd/biodb/actions/workflows/ci.yml/badge.svg)](https://github.com/rispadd/biodb/actions/workflows/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/biodb/badge/?version=latest)](https://biodb.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/RISPaDD/biodb/graph/badge.svg?token=Ld95EDCYNZ)](https://codecov.io/gh/RISPaDD/biodb)
[![Security](https://github.com/rispadd/biodb/actions/workflows/security.yml/badge.svg)](https://github.com/rispadd/biodb/actions/workflows/security.yml)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10048241.svg)](https://doi.org/10.5281/zenodo.10048241)

![SSEC-JHU Logo](docs/_static/SSEC_logo_horiz_blue_1152x263.png)
Expand Down Expand Up @@ -62,7 +62,7 @@ For additional cmds see the [Conda cheat-sheet](https://docs.conda.io/projects/c
#### with Python ecosystem (for development):
* Follow the above [Build with Python ecosystem instructions](#with-python-ecosystem).
* For a completely fresh start and rebuild of the database: ``./scripts/dev/rebuild_sqlite.sh``.
* Run ``DJANGO_SETTINGS_MODULE=biospecdb.settings.dev python manage.py runserver 0.0.0.0:8000``
* Run ``DJANGO_SETTINGS_MODULE=biodb.settings.dev python manage.py runserver 0.0.0.0:8000``
* The site can then be accessed using any browser from ``http://localhost:8000``

### Self signed SSL certificates:
Expand Down Expand Up @@ -117,8 +117,8 @@ When the models are changed only the following migration commands are required:
* ``python manage.py makemigrations user``
* ``python manage.py makemigrations uploader``
* ``python manage.py makemigrations catalog``
* ``git add biospecdb/apps/uploader/migrations``
* ``git add biospecdb/apps/user/migrations``
* ``git add biodb/apps/uploader/migrations``
* ``git add biodb/apps/user/migrations``
* ``git commit -asm"Update model migrations"``
* ``python manage.py migrate``
* ``python manage.py migrate --database=bsr``
Expand Down Expand Up @@ -157,7 +157,7 @@ _NOTE: These commands must be run from the ``/app/`` directory on the server.

The above management commands (and others) can be run in production from an EC2 instance correctly configured. To
aid in shell setup, the following script can be executed:
* ``source repo/biospecdb/scripts/prd/ec2_init.sh``
* ``source repo/biodb/scripts/prd/ec2_init.sh``

_NOTE: ``scripts/prd/ec2_init.sh`` will export all AWS secrets as shell environment variables.

Expand All @@ -180,7 +180,7 @@ Entries in the ``SpectralData`` table can be annotated by running ``QCAnnotators
stored as an ``ACAnnotation`` associated with the ``SpectralData`` entry. The ``SpectralData`` table contains the actual
spectral data file containing the wavelength and intensity values. It may be desirable to annotate this data with
certain quality control metrics that can later be used to filter the data. Such quality control functions are to be
implemented as a subclass of ``Biospecdb.app.uploader.qc.qcfilter.QcFilter``.
implemented as a subclass of ``biodb.app.uploader.qc.qcfilter.QcFilter``.
They can then be added to the database belonging to the ``QCAnnotator``
table. Annotations of this annotators can then either be manually associated with a ``SpectralData`` entry manually via
the admin form, or by "default" if the ``QCAnnotator.default = True``. They can also be run by using the
Expand All @@ -189,7 +189,7 @@ population of the ``QCAnnotation`` table is configurable and is described below.

#### Settings:

The following QC annotator settings are available in ``biospecdb.settings.base``:
The following QC annotator settings are available in ``biodb.settings.base``:

* ``AUTO_ANNOTATE``: If ``True`` and if default annotators exist in the DB, they will be automatically run upon
adding/updating ``SpectralData`` entries. _(Default: True)_
Expand Down Expand Up @@ -220,7 +220,7 @@ Facilitates in testing typos, syntax, style, and other simple code analysis test
### Security Checks:
Facilitates in checking for security concerns using [Bandit](https://bandit.readthedocs.io/en/latest/index.html).
* ``cd`` into repo dir.
* ``bandit -c pyproject.toml --severity-level=medium -r biospecdb``
* ``bandit -c pyproject.toml --severity-level=medium -r biodb``

### Unit Tests:
Facilitates in testing core package functionality at a modular level.
Expand Down Expand Up @@ -248,7 +248,7 @@ Facilitates in building, testing & viewing the docs.

# The DB Model:

![BioSpecDB Model.jpg](..%2F..%2F..%2FDownloads%2FBioSpecDB%20Model.jpg)
![biodb Model.jpg](..%2F..%2F..%2FDownloads%2Fbiodb%20Model.jpg)

## Column Names:

Expand Down
4 changes: 2 additions & 2 deletions apprunner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
- pipenv run make -C docs html
env:
- name: DJANGO_SETTINGS_MODULE
value: "biospecdb.settings.aws"
value: "biodb.settings.aws"
run:
runtime-version: 3.11
pre-run:
Expand All @@ -24,7 +24,7 @@ run:
- name: DB_VENDOR
value: "postgresql"
- name: DJANGO_SETTINGS_MODULE
value: "biospecdb.settings.aws"
value: "biodb.settings.aws"
secrets:
- name: EMAIL_USE_TLS
value-from: "arn:aws:secretsmanager:eu-west-2:339712857727:secret:EMAIL_USE_TLS-KbwnER"
Expand Down
2 changes: 1 addition & 1 deletion biodb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__project__ = "biospecdb"
__project__ = "biodb"

try:
from ._version import __version__
Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/catalog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _

from biospecdb import __version__
from biodb import __version__
from explorer.models import Query
from uploader.base_models import DatedModel

Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/catalog/tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from biospecdb import __version__
from biodb import __version__
from catalog.models import Dataset
from explorer.models import Query
from uploader.models import SpectralData
Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/uploader/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django import forms
from nested_admin import NestedStackedInline, NestedTabularInline, NestedModelAdmin

from biospecdb.util import to_bool
from biodb.util import to_bool
from .models import BioSample, Observable, Instrument, Patient, SpectralData, Observation, UploadedFile, Visit,\
QCAnnotator, QCAnnotation, Center, get_center, BioSampleType, SpectraMeasurementType
from uploader.forms import ModelForm
Expand Down
6 changes: 3 additions & 3 deletions biodb/apps/uploader/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.db import connection, models, transaction
from django.utils.module_loading import import_string

import biospecdb.util
import biodb.util
from uploader.sql import drop_view, update_view


Expand Down Expand Up @@ -131,7 +131,7 @@ def cast(self, value):
return

if self.name == "BOOL":
return biospecdb.util.to_bool(value)
return biodb.util.to_bool(value)
elif self.name == "STR":
return str(value)
elif self.name == "INT":
Expand Down Expand Up @@ -217,4 +217,4 @@ def save(self, *args, update_view=True, **kwargs):
sql_view.update_view()

def asave(self, *args, **kwargs):
raise NotImplementedError("See https://github.com/rispadd/biospecdb/issues/66")
raise NotImplementedError("See https://github.com/rispadd/biodb/issues/66")
2 changes: 1 addition & 1 deletion biodb/apps/uploader/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import uploader.io
from uploader.models import Observable, Patient, SpectralData
from biospecdb.util import to_uuid
from biodb.util import to_uuid

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/uploader/fixtures/qcannotators.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pk": 1,
"fields": {
"name": "sum",
"fully_qualified_class_name": "biospecdb.qc.qcfilter.QcSum",
"fully_qualified_class_name": "biodb.qc.qcfilter.QcSum",
"description": "Sum of the spectral data (total flux)",
"default": true,
"value_type": "FLOAT",
Expand Down
4 changes: 2 additions & 2 deletions biodb/apps/uploader/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pandas as pd
from pandas._libs.parsers import STR_NA_VALUES

from biospecdb.util import StrEnum, to_uuid
from biodb.util import StrEnum, to_uuid

# TODO: move to settings
DEFAULT_PATIENT_ID_STR = "patient_id"
Expand Down Expand Up @@ -109,7 +109,7 @@ def _read_raw_data(file, ext=None):
# ‘NULL’, ‘NaN’, ‘None’, ‘n/a’, ‘nan’, ‘null’.

# NOTE: When the file size is > 2.5M Django will chunk and this will need to be handled. See
# https://github.com/rispadd/biospecdb/issues/38
# https://github.com/rispadd/biodb/issues/38
if ext == FileFormats.CSV:
data = pd.read_csv(file, **kwargs)
elif ext == FileFormats.XLSX:
Expand Down
4 changes: 2 additions & 2 deletions biodb/apps/uploader/loaddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.db import transaction
from django.db.models import Q

from biospecdb.util import get_object_or_raise_validation
from biodb.util import get_object_or_raise_validation
import uploader.io


Expand Down Expand Up @@ -107,7 +107,7 @@ def save_data_to_db(meta_data, spectral_data, center=None, joined_data=None, dry
continue

# TODO: Should the following logic belong to Observation.__init__()?
# See https://github.com/rispadd/biospecdb/issues/42
# See https://github.com/rispadd/biodb/issues/42
observation_value = Observable.Types(observable.value_class).cast(observation_value)
observation = Observation(observable=observable,
visit=visit,
Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/uploader/management/commands/send_test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def handle(self, *args, **options):
form.save(**opts)
else:
email_from = settings.EMAIL_FROM
send_mail("BiospecDB test email", "This is just a test.", email_from, [email_address],
send_mail("biodb test email", "This is just a test.", email_from, [email_address],
fail_silently=False)
self.stdout.write(self.style.SUCCESS(f"Test email sent to {email_address}, check inbox for verification."))
except CommandError:
Expand Down
14 changes: 7 additions & 7 deletions biodb/apps/uploader/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from django.utils.translation import gettext_lazy as _
import pandas as pd

from biospecdb.util import get_field_value, get_object_or_raise_validation, is_valid_uuid, lower, to_uuid
from biospecdb.qc.qcfilter import QcFilter
from biodb.util import get_field_value, get_object_or_raise_validation, is_valid_uuid, lower, to_uuid
from biodb.qc.qcfilter import QcFilter
import uploader.io
from uploader.loaddata import save_data_to_db
from uploader.sql import secure_name
Expand All @@ -26,7 +26,7 @@
# Changes here need to be migrated, committed, and activated.
# See https://docs.djangoproject.com/en/4.2/intro/tutorial02/#activating-models
# python manage.py makemigrations uploader
# git add biospecdb/apps/uploader/migrations
# git add biodb/apps/uploader/migrations
# git commit -asm"Update uploader model(s)"
# python manage.py migrate --database=bsr

Expand Down Expand Up @@ -898,11 +898,11 @@ def clean(self):
self.data = cleaned_file

#@transaction.atomic(using="bsr") # Really? Not sure if this even can be if run in background...
# See https://github.com/rispadd/biospecdb/issues/77
# See https://github.com/rispadd/biodb/issues/77
def annotate(self, annotator=None, force=False) -> list:
""" Run the quality control annotation on the spectral data. """
# TODO: This needs to return early and run in the background.
# See https://github.com/rispadd/biospecdb/issues/77
# See https://github.com/rispadd/biodb/issues/77

existing_annotators = self.get_annotators()

Expand Down Expand Up @@ -939,7 +939,7 @@ def save(self, *args, **kwargs):
# such that new data is complete such that it has associated QC metrics.
if settings.AUTO_ANNOTATE:
# TODO: This should return early and runs async in the background.
# See https://github.com/rispadd/biospecdb/issues/77
# See https://github.com/rispadd/biodb/issues/77
self.annotate()

def asave(self, *args, **kwargs):
Expand Down Expand Up @@ -1204,7 +1204,7 @@ def get_value(self):
return self.annotator.cast(self.value)

def run(self, save=True):
# NOTE: This waits. See https://github.com/rispadd/biospecdb/issues/77
# NOTE: This waits. See https://github.com/rispadd/biodb/issues/77
value = self.annotator.run(self.spectral_data)
self.value = value

Expand Down
2 changes: 1 addition & 1 deletion biodb/apps/uploader/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pytest


from biospecdb.util import find_package_location
from biodb.util import find_package_location
from uploader.models import SpectralData, UploadedFile, Center
from user.models import Center as UserCenter

Expand Down
8 changes: 4 additions & 4 deletions biodb/apps/uploader/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from uploader.loaddata import save_data_to_db
from user.models import Center as UserCenter
from uploader.models import Center as UploaderCenter
import biospecdb.util
import biodb.util
from uploader.tests.conftest import bulk_upload, DATA_PATH


Expand Down Expand Up @@ -342,7 +342,7 @@ def test_files_added(self, mock_data_from_files):

def test_no_file_validation(self, db):
""" Test that a validation error is raised rather than any other python exception which would indicate a bug.
See https://github.com/rispadd/biospecdb/pull/181
See https://github.com/rispadd/biodb/pull/181
"""
data = SpectralData()
with pytest.raises(ValidationError):
Expand All @@ -366,7 +366,7 @@ def test_no_duplicate_data_files(self, mock_data_from_files):

@pytest.mark.skip("Unimplemented See #141")
def test_all_files_deleted_upon_transaction_failure(self):
# I'm not sure how to mock this... See https://github.com/rispadd/biospecdb/issues/141
# I'm not sure how to mock this... See https://github.com/rispadd/biodb/issues/141
...

@pytest.mark.parametrize("ext", uploader.io.FileFormats.list())
Expand Down Expand Up @@ -487,7 +487,7 @@ def test_patient_ids(self, mock_data_from_files, file_ext):
def test_index_match_validation(self, db, observables, instruments, file_ext, tmp_path):
meta_data_path = (DATA_PATH / "meta_data").with_suffix(file_ext)

biospecdb.util.mock_bulk_spectral_data(path=tmp_path)
biodb.util.mock_bulk_spectral_data(path=tmp_path)
spectral_file_path = tmp_path / "spectral_data.csv"
with meta_data_path.open(mode="rb") as meta_data, spectral_file_path.open(mode="rb") as spectral_data:
data_upload = UploadedFile(meta_data_file=django.core.files.File(meta_data,
Expand Down
Loading

0 comments on commit 049a0db

Please sign in to comment.