Skip to content

Commit 83817e0

Browse files
committed
- Changed name to ethoscope_metadata_db of which server is just one feature
- Transition this to an installable package, independent of ethoscopy - Adding an .export() function to metadata_db
1 parent 5b9c5a4 commit 83817e0

38 files changed

+31
-3
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN apt-get update && \
1414
RUN pip install bottle pandas
1515

1616
WORKDIR /opt
17-
RUN git clone https://github.com/gilestrolab/ethoscope_metadata_server.git
17+
RUN git clone https://github.com/gilestrolab/ethoscope_metadata_db.git
1818

19-
WORKDIR /opt/ethoscope_metadata_server
19+
WORKDIR /opt/ethoscope_metadata_db
2020
CMD ["python", "/opt/ethoscope_metadata_server/metadata_db_server.py", "--refresh", "--metadata", "/opt/ethoscope_metadata"]
2121

2222

ethoscope_metadata_db/__init__.py

Whitespace-only changes.

metadata_db.py ethoscope_metadata_db/metadata_db.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#
2323
#
2424

25-
__version__ = 1.0
25+
__version__ = 1.1
2626

2727
import pandas as pd
2828
import fnmatch
@@ -331,7 +331,27 @@ def save( self, project = None):
331331

332332

333333
return True
334+
335+
def export( self, filename, only_dbs=True, include_missing=False ):
336+
'''
337+
This is the export function that generates a txt file containing the list of db files
338+
339+
In the default behaviour, with only_dbs == True, the resulting text file can then be used
340+
with rsync to copy all the files to a secondary folder, which is useful to upload to public repositories
341+
'''
334342

343+
if include_missing:
344+
dt = self.db_files
345+
else:
346+
dt = self.db_files.loc[~self.db_files.db_filename.isna()]
347+
348+
if only_dbs:
349+
#Save to a txt file only the databases we have actually found
350+
dt.db_filename.to_csv(filename, header=None, index=None)
351+
else:
352+
dt.to_csv(filename, index=None)
353+
354+
335355

336356
class metadata_crawler():
337357

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name='ethoscope_metadata_db',
5+
version='1.1',
6+
packages=find_packages(),
7+
# other metadata
8+
)

0 commit comments

Comments
 (0)