Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 204 when responding head request #132

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
22b6e8f
update XsamsRadTranBroadening function to work with starkb
nicolasmoreau Jun 21, 2017
ad46adb
remove count function from dictionnary to move it in model
nicolasmoreau Jun 21, 2017
6e0ffb3
Merge branch 'master' of https://github.com/VAMDC/NodeSoftware
nicolasmoreau Jan 22, 2018
7d4e82b
Add a makeEscapedOptionalTag, identical to makeOptionalTag but escapi…
nicolasmoreau Jan 22, 2018
556540e
remove encode functions from stark-b models thanks to makeEscapedOpti…
nicolasmoreau Jan 22, 2018
aed8dd3
update SpeciesDB code with new version by Misha Doronin and Nicolas M…
nicolasmoreau Feb 19, 2018
d99acf1
add functions to escape content of some fields in models
nicolasmoreau Feb 19, 2018
34ee57a
add missing files
nicolasmoreau Feb 19, 2018
85ca93b
escape journal name in starkb
nicolasmoreau Feb 20, 2018
36404af
remove makeEscapedOptionalTag from generators.py, rely on node to do …
nicolasmoreau Feb 20, 2018
0217950
add a "update_status" column in the species database.
nicolasmoreau Feb 22, 2018
1d5fcd4
remove print
nicolasmoreau Feb 22, 2018
48a0638
update node only if update_status == 1
nicolasmoreau Mar 14, 2018
9fdd399
make short_title field content longer
nicolasmoreau Mar 14, 2018
acb13f0
Merge branch 'master' of https://github.com/VAMDC/NodeSoftware
nicolasmoreau Jul 11, 2018
18f674c
Do not create response content when a HEAD request is received
nicolasmoreau Jul 11, 2018
b5b573b
improve response to head request.
nicolasmoreau Jul 13, 2018
5f8edb7
Remove modifications made in the generator for starkb
nicolasmoreau Jul 16, 2018
f533067
comment unused function
nicolasmoreau Jul 16, 2018
6b883d1
use python3 compatible syntax
nicolasmoreau Feb 21, 2019
3c874ea
rewrites urls.py with django 1.10 compatibility
nicolasmoreau Mar 26, 2019
042f093
correction of an indentation error
nicolasmoreau Mar 26, 2019
995f8de
urls in django1.10 format
nicolasmoreau Mar 27, 2019
ece81c1
modification in the iteration on the content of self.parsedSQL.column…
nicolasmoreau Mar 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 8 additions & 36 deletions nodes/VamdcSpeciesDB/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,20 @@
README
------

The ExampleNode is intended as a starting point for setting up your own VAMDC node from
scratch. The node contains a basic setup and contains some mock data (in example_data)
to test the data import and setup tools on.
The VAMDC Species Database node,

More verbose information can be found in the online documentation.
You can also build the documentation from the vamdc/doc/ directory.
Data ingestion cron job script:
python2 node/cronjob.py


Basic steps for testing the examplenode
(assuming you have all dependencies):
---------------------------------------

1) Copy folder ExampleNode to a new name and do everything from that
Exporting the data into sqlite database:
export_sqlite.sh in the VamdcSpeciesDB directory, using the helper scripts and export model in the export/ directory.

2) Setup mysql database (the default used in the example)
Once the export model is changed, please remove export/migrations contents and run
./manage.py makemigrations export to recreate the exported data model.

3) Configure Django
The data is exported into speciesdb.sqlite

$ cd <yournode>
$ python manage.py

Edit the created settings.py file to add all database details

4) Edit mapping_examplenode.py so that all paths given match your actual path

5) Run the database rewrite

$ cd ../importtools
$ python run_export.py ../node/<YourNode>/mapping_examplenode.py

This will parse the raw data files in example_data and creates new
files *.in in node/<YourNode>.

6) Import preprocessed data into database

$ cd ../node/<YourNode>
$ mysql -d <YourDatabaseName> -u <YourDBusername> -p < load.sql

The preprocessed data should be loaded into the database.

7) Startup web services

Follow the online manual to start a webserver, then, depending
on how you set it up, point a webbrowser to something like
http://YourURL/node/Yournode/tap/capabilities/ to test if things work.
28 changes: 0 additions & 28 deletions nodes/VamdcSpeciesDB/apache.conf

This file was deleted.

2 changes: 1 addition & 1 deletion nodes/VamdcSpeciesDB/django.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import os
import sys

# EDIT THE FOLLOWING TWO LINES
sys.path.append('/var/cdms/v1_0/NodeSoftware/')
sys.path.append('/home/doronin/space/doronin/VAMDC/python/NodeSoftware/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'nodes.VamdcSpeciesDB.settings'

from django.core.wsgi import get_wsgi_application
Expand Down
14 changes: 0 additions & 14 deletions nodes/VamdcSpeciesDB/gunicorn.conf

This file was deleted.

10 changes: 0 additions & 10 deletions nodes/VamdcSpeciesDB/load.sql

This file was deleted.

8 changes: 6 additions & 2 deletions nodes/VamdcSpeciesDB/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
print string
sys.exit()
# Run the django setup using our settings file.
from django.core.management import execute_manager
#from django.core.management import execute_manager
#from xml.sax import saxutils
execute_manager(settings)
#execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
170 changes: 0 additions & 170 deletions nodes/VamdcSpeciesDB/models.py

This file was deleted.

21 changes: 21 additions & 0 deletions nodes/VamdcSpeciesDB/node/InchiInfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from openbabel import OBConversion,OBMol


class InchiInfo:

def __init__(self,inchi):
self.obconversion = OBConversion()
self.obconversion.SetInFormat("inchi")
self.obmol = OBMol()

self.obconversion.ReadString(self.obmol, inchi)

self.totalCharge = self.obmol.GetTotalCharge()
self.formula = self.obmol.GetFormula()
self.weight = self.obmol.GetMolWt( )

def getNumAtoms(self):
return self.obmol.NumAtoms()

def getAtoms(self,idx):
return self.GetAtom(idx)
52 changes: 51 additions & 1 deletion nodes/VamdcSpeciesDB/node/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,56 @@
#import your models here like this:
#from DjNodeExample.node.models import *

from models import *


# add your models here to have them in the admin interface
# for example if you have a model class called "Transition":
#admin.site.register(Transition)

class VamdcNodesAdmin(admin.ModelAdmin):
def make_active(modeladmin, request, queryset):
queryset.update(status=RecordStatus.ACTIVE)
make_active.short_description = "Activate selected nodes"


def make_disabled(modeladmin, request, queryset):
queryset.update(status=RecordStatus.DISABLED)
make_disabled.short_description = "Disable selected nodes"

list_display = ('short_name','status','contact_email','last_update_date')

actions = [make_active,make_disabled]


class VamdcSpeciesAdmin(admin.ModelAdmin):
def make_verified(modeladmin, request, queryset):
queryset.update(status=RecordStatus.ACTIVE)
make_verified.short_description = "Mark as verified"

def make_disabled(modeladmin, request, queryset):
queryset.update(status=RecordStatus.DISABLED)
make_disabled.short_description = "Mark as hidden/disabled"


list_display = ('mass_number','stoichiometric_formula', 'structural_formula_all','charge','origin_member_database','status','species_foreign_ids')

actions = [make_verified,make_disabled]

class VamdcSpeciesNamesAdmin(admin.ModelAdmin):
def make_verified(modeladmin, request, queryset):
queryset.update(status=RecordStatus.ACTIVE)
make_verified.short_description = "Mark as verified"

def make_disabled(modeladmin, request, queryset):
queryset.update(status=RecordStatus.DISABLED)
make_disabled.short_description = "Mark as hidden/disabled"


list_display = ('species','name','id', 'species','status')

actions = [make_verified,make_disabled]


admin.site.register(VamdcNodes,VamdcNodesAdmin)
admin.site.register(VamdcSpecies,VamdcSpeciesAdmin)
#~ admin.site.register(VamdcSpeciesNames,VamdcSpeciesNamesAdmin)
Loading