Skip to content

Commit

Permalink
Merge pull request #1020 from scieloorg/beta
Browse files Browse the repository at this point in the history
Incorporação de códigos estáveis
  • Loading branch information
jamilatta committed Oct 3, 2014
2 parents 79472e2 + 4ab5227 commit 1ae66db
Show file tree
Hide file tree
Showing 26 changed files with 1,613 additions and 214 deletions.
267 changes: 139 additions & 128 deletions docs/dev/journals-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ Response:
"Biological Sciences"
],
subject_categories: [
"Humanities, Multidisciplinary",
"Social Sciences, Interdisciplinary",
"Sociology"
"Humanities, Multidisciplinary",
"Social Sciences, Interdisciplinary",
"Sociology"
],
"subject_descriptors": "biologia\nbotanica",
"succeeding_title": null,
Expand Down Expand Up @@ -630,6 +630,11 @@ Response:
],
"study_areas": [

],
subject_categories: [
"Humanities, Multidisciplinary",
"Social Sciences, Interdisciplinary",
"Sociology"
],
"subject_descriptors": "public health",
"succeeding_title": null,
Expand All @@ -651,131 +656,137 @@ Response:

**Example of version 2 with multiple collections**::

{
"abstract_keyword_languages": null,
"acronym": "RSP",
"collections": [
"Saude Publica",
"Brasil"
],
"contact": null,
"copyrighter": "Faculdade de Sa\u00c3\u00bade P\u00c3\u00bablica da Universidade de S\u00c3\u00a3o Paulo",
"cover": null,
"created": "1998-04-30T00:00:00",
"creator": "/api/v2/users/1/",
"ctrl_vocabulary": "decs",
"current_ahead_documents": 0,
"editor_address": "Avenida Dr. Arnaldo, 715, 01246-904 S\u00c3\u00a3o Paulo SP Brazil, Tel./Fax: +55 11 3068-0539",
"editor_address_city": "",
"editor_address_country": "",
"editor_address_state": "",
"editor_address_zip": "",
"editor_email": "",
"editor_name": "",
"editor_phone1": "",
"editor_phone2": null,
"editorial_standard": "vancouv",
"eletronic_issn": "",
"final_num": "",
"final_vol": "",
"final_year": null,
"frequency": "B",
"id": 20,
"index_coverage": "cab-health\nembase\npopline\nlilacs\nadsa\u00c3\u00bade\ndocpal\nabstracts on hygiene and communicable diseases\nabstracts on zooparasitology\nbiological abstracts\ncurrent contents/social & behavioral science\nentomology abstracts\nexcerpta medica\nindex medicus\nmicrobiology abstracts\nnutrition abstracts and reviews-seriesb\nreview medical veterinary entomology\nsafety science abstracts journal\nsocial science citation index\ntropical diseases bulletin\nveterinary bulletin\nvirology abstracts\nisi \npubmed",
"init_num": "1",
"init_vol": "1",
"init_year": "1967",
"is_indexed_aehci": false,
"is_indexed_scie": false,
"is_indexed_ssci": false,
"is_trashed": false,
"issues": [
"/api/v2/issues/184/",
"/api/v2/issues/186/",
"/api/v2/issues/187/",
"/api/v2/issues/188/",
],
"languages": [
"en",
"pt",
"es"
],
"logo": null,
"medline_code": null,
"medline_title": null,
"missions": {
"en": "To publish and divulge scientific production on subjects of relevance to Public Health",
"es": "Publicar y diseminar productos del trabajo cient\u00c3\u00adfico relevantes para la Salud P\u00c3\u00bablica",
"pt": "Publicar e disseminar produtos do trabalho cient\u00c3\u00adfico que sejam relevantes para a Sa\u00c3\u00bade P\u00c3\u00bablica"
},
"national_code": "068227-6",
"notes": "",
"other_previous_title": "",
"other_titles": {
"other": "Rev Saude Publica",
"paralleltitle": "Journal of Public Health"
},
"previous_ahead_documents": 0,
"previous_title": null,
"print_issn": "0034-8910",
"pub_level": "CT",
"pub_status": {
"Saude Publica": "deceased"
},
"pub_status_history": [
{
"abstract_keyword_languages": null,
"acronym": "RSP",
"collections": [
"Saude Publica"
],
"contact": null,
"copyrighter": "Faculdade de Sa\u00c3\u00bade P\u00c3\u00bablica da Universidade de S\u00c3\u00a3o Paulo",
"cover": null,
"created": "1998-04-30T00:00:00",
"creator": "/api/v2/users/1/",
"ctrl_vocabulary": "decs",
"current_ahead_documents": 0,
"editor_address": "Avenida Dr. Arnaldo, 715, 01246-904 S\u00c3\u00a3o Paulo SP Brazil, Tel./Fax: +55 11 3068-0539",
"editor_address_city": "",
"editor_address_country": "",
"editor_address_state": "",
"editor_address_zip": "",
"editor_email": "",
"editor_name": "",
"editor_phone1": "",
"editor_phone2": null,
"editorial_standard": "vancouv",
"eletronic_issn": "",
"final_num": "",
"final_vol": "",
"final_year": null,
"frequency": "B",
"id": 20,
"index_coverage": "cab-health\nembase\npopline\nlilacs\nadsa\u00c3\u00bade\ndocpal\nabstracts on hygiene and communicable diseases\nabstracts on zooparasitology\nbiological abstracts\ncurrent contents/social & behavioral science\nentomology abstracts\nexcerpta medica\nindex medicus\nmicrobiology abstracts\nnutrition abstracts and reviews-seriesb\nreview medical veterinary entomology\nsafety science abstracts journal\nsocial science citation index\ntropical diseases bulletin\nveterinary bulletin\nvirology abstracts\nisi \npubmed",
"init_num": "1",
"init_vol": "1",
"init_year": "1967",
"is_indexed_aehci": false,
"is_indexed_scie": false,
"is_indexed_ssci": false,
"is_trashed": false,
"issues": [
"/api/v2/issues/184/",
"/api/v2/issues/186/",
"/api/v2/issues/187/",
"/api/v2/issues/188/",
],
"languages": [
"en",
"pt",
"es"
],
"logo": null,
"medline_code": null,
"medline_title": null,
"missions": {
"en": "To publish and divulge scientific production on subjects of relevance to Public Health",
"es": "Publicar y diseminar productos del trabajo cient\u00c3\u00adfico relevantes para la Salud P\u00c3\u00bablica",
"pt": "Publicar e disseminar produtos do trabalho cient\u00c3\u00adfico que sejam relevantes para a Sa\u00c3\u00bade P\u00c3\u00bablica"
},
"national_code": "068227-6",
"notes": "",
"other_previous_title": "",
"other_titles": {
"other": "Rev Saude Publica",
"paralleltitle": "Journal of Public Health"
},
"previous_ahead_documents": 0,
"previous_title": null,
"print_issn": "0034-8910",
"pub_level": "CT",
"pub_status": {
"Saude Publica": "deceased"
},
"pub_status_history": [
{
"date": "2014-08-14T14:57:05.940893",
"status": "deceased"
},
{
"date": "2014-04-23T10:30:29.470427",
"status": "current"
}
],
"pub_status_reason": {
"Saude Publica": "teste"
},
"publication_city": "S\u00c3\u00a3o Paulo",
"publisher_country": "BR",
"publisher_name": "Faculdade de Sa\u00c3\u00bade P\u00c3\u00bablica da Universidade de S\u00c3\u00a3o Paulo",
"publisher_state": "SP",
"resource_uri": "/api/v2/journals/20/",
"scielo_issn": "print",
"secs_code": "",
"sections": [
"/api/v2/sections/44/",
"/api/v2/sections/45/",
"/api/v2/sections/46/",
"/api/v2/sections/47/",
"/api/v2/sections/48/",
"/api/v2/sections/49/",
"/api/v2/sections/50/",
"/api/v2/sections/51/",
"/api/v2/sections/52/",
"/api/v2/sections/53/",
"/api/v2/sections/54/",
"/api/v2/sections/55/",
],
"short_title": "Rev. Sa\u00c3\u00bade P\u00c3\u00bablica",
"sponsors": [
"date": "2014-08-14T14:57:05.940893",
"status": "deceased"
},
{
"date": "2014-04-23T10:30:29.470427",
"status": "current"
}
],
"pub_status_reason": {
"Saude Publica": "teste"
},
"publication_city": "S\u00c3\u00a3o Paulo",
"publisher_country": "BR",
"publisher_name": "Faculdade de Sa\u00c3\u00bade P\u00c3\u00bablica da Universidade de S\u00c3\u00a3o Paulo",
"publisher_state": "SP",
"resource_uri": "/api/v2/journals/20/",
"scielo_issn": "print",
"secs_code": "",
"sections": [
"/api/v2/sections/44/",
"/api/v2/sections/45/",
"/api/v2/sections/46/",
"/api/v2/sections/47/",
"/api/v2/sections/48/",
"/api/v2/sections/49/",
"/api/v2/sections/50/",
"/api/v2/sections/51/",
"/api/v2/sections/52/",
"/api/v2/sections/53/",
"/api/v2/sections/54/",
"/api/v2/sections/55/",
],
"short_title": "Rev. Sa\u00c3\u00bade P\u00c3\u00bablica",
"sponsors": [

],
"study_areas": [
],
"study_areas": [

],
"subject_descriptors": "saude coletiva\nsaude publica\nmicrobiologia",
"succeeding_title": null,
"title": "Revista de Sa\u00c3\u00bade P\u00c3\u00bablica",
"title_iso": "Rev. sa\u00c3\u00bade p\u00c3\u00bablica",
"twitter_user": null,
"updated": "2014-04-03T15:08:35.586311",
"url_journal": null,
"url_online_submission": null,
"use_license": {
"disclaimer": "<p> </p>",
"id": 4,
"is_default": false,
"license_code": "nd",
"reference_url": null,
"resource_uri": "/api/v2/uselicenses/4/"
}
}
],
subject_categories: [
"Humanities, Multidisciplinary",
"Social Sciences, Interdisciplinary",
"Sociology"
],
"subject_descriptors": "saude coletiva\nsaude publica\nmicrobiologia",
"succeeding_title": null,
"title": "Revista de Sa\u00c3\u00bade P\u00c3\u00bablica",
"title_iso": "Rev. sa\u00c3\u00bade p\u00c3\u00bablica",
"twitter_user": null,
"updated": "2014-04-03T15:08:35.586311",
"url_journal": null,
"url_online_submission": null,
"use_license": {
"disclaimer": "<p> </p>",
"id": 4,
"is_default": false,
"license_code": "nd",
"reference_url": null,
"resource_uri": "/api/v2/uselicenses/4/"
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ django-tastypie==0.9.16
django-waffle==0.9.1
-e git+git://github.com/scieloorg/django-htmlmin.git#egg=django-htmlmin
-e git+git://github.com/scieloorg/django-cache-machine.git#egg=django-cache-machine
packtools==0.5dev-20140924
packtools==0.5
Celery
django-celery
django-kombu
Expand Down
13 changes: 13 additions & 0 deletions scielomanager/api/resources_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class Meta(ApiKeyAuthMeta):
allowed_methods = ['get', ]


class SubjectCategoryResource(ModelResource):
class Meta(ApiKeyAuthMeta):
queryset = models.SubjectCategory.objects.all()
resource_name = 'subjectcategory'
allowed_methods = ['get', ]


class SectionResource(ModelResource):
journal = fields.ForeignKey('api.resources_v2.JournalResource',
'journal')
Expand Down Expand Up @@ -235,6 +242,8 @@ class JournalResource(ModelResource):
collections = fields.ManyToManyField(CollectionResource, 'collections')
issues = fields.OneToManyField(IssueResource, 'issue_set')
sections = fields.OneToManyField(SectionResource, 'section_set')
subject_categories = fields.ManyToManyField(SubjectCategoryResource,
'subject_categories', readonly=True)

#Recursive field
previous_title = fields.ForeignKey('self', 'previous_title', null=True)
Expand Down Expand Up @@ -304,6 +313,10 @@ def dehydrate_pub_status_reason(self, bundle):
def dehydrate_collections(self, bundle):
return [col.name for col in bundle.obj.collections.all()]

def dehydrate_subject_categories(self, bundle):
return [subject_category.term
for subject_category in bundle.obj.subject_categories.all()]


class DataChangeEventResource(ModelResource):
collection_uri = fields.ForeignKey(CollectionResource, 'collection')
Expand Down
1 change: 1 addition & 0 deletions scielomanager/api/tests_resources_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def test_api_datamodel(self):
u'twitter_user',
u'previous_title',
u'succeeding_title',
u'subject_categories'
]

json_keys = set(response.json.keys())
Expand Down
14 changes: 6 additions & 8 deletions scielomanager/articletrack/tests/tests_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,21 @@ def get_xml_uri(self, attempt_id, target_name):
balaio()
self.mocker.result(BalaioTest())

XMLValidator = self.mocker.replace('packtools.stylechecker.XMLValidator')
XMLValidator(mocker.ANY)
self.mocker.result(packtools_double.XMLValidatorDouble(mocker.ANY))
stub_analyze_xml = packtools_double.make_stub_analyze_xml('valid')
mock_utils = self.mocker.replace('validator.utils')
mock_utils.analyze_xml
self.mocker.result(stub_analyze_xml)

self.mocker.replay()

# when
response = self.app.get(
reverse('notice_detail', args=[notice.checkin.pk]),
user=self.user)

# then
xml_data = response.context['xml_data']
self.assertEqual(response.status_code, 200)
self.assertTrue(xml_data['can_be_analyzed'][0])
self.assertIsNone(response.context['results'])
self.assertIsNone(response.context['xml_exception'])
self.assertEqual(xml_data['uri'], expected_response['uri'])
self.assertEqual(xml_data['file_name'], expected_response['filename'])
Expand Down Expand Up @@ -376,9 +377,6 @@ def get_xml_uri(self, attempt_id, target_name):
results = response.context['results']
self.assertIsNotNone(results)
self.assertIsNotNone(results['annotations'])
validation_errors = results['validation_errors']
self.assertIsNotNone(validation_errors)
self.assertEqual(1, len(validation_errors))

def test_xml_not_found(self):
self._addWaffleFlag()
Expand Down
1 change: 0 additions & 1 deletion scielomanager/audit_log/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def collect_new_values(form, formsets=None, as_json_string=False):
"formsets_data": [],
}

new_values = []
for field_name in get_auditable_fields(form):
field_value = form.cleaned_data[field_name]
result["form_data"][field_name] = field_serializer(field_serializer(field_value))
Expand Down
Loading

0 comments on commit 1ae66db

Please sign in to comment.