diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fa3d124..2cf31d4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,16 @@ -3.1.1 +3.1.2 (2014-07-25) +------------------ + +HEALTH-104: Health Setup data failures +HEALTH-28: Health load setup data. Drugs and Treatments did not import +HEALTH-105: Case syndromic classifications site eror in setup +HEALTH-93: AR. Updating Info portion +HEALTH-27: AR Create. Copying Patient fields across does not autocomplete corresponding Name or ID + +- Plus Bika-LIMS 3.1.2 and 3.1.3: http://git.io/MWb4dQ + + +3.1.1 (2014-07-11) ------------------ HEALTH-122: Client contact cannot open Client page/AR page blank diff --git a/README.md b/README.md index 70c7d8b..a70c29a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Bika Health 3.1.1 (Naringenin) +Bika Health 3.1.2 (Naringenin) ================ Bika Laboratory Information Management System customised for use in Health laboratories. diff --git a/bika/health/content/casesyndromicclassification.py b/bika/health/content/casesyndromicclassification.py index d59b277..827ca6d 100644 --- a/bika/health/content/casesyndromicclassification.py +++ b/bika/health/content/casesyndromicclassification.py @@ -1,21 +1,28 @@ -from AccessControl import ClassSecurityInfo -from Products.Archetypes.public import BaseContent -from Products.Archetypes.public import registerType -from bika.lims.content.bikaschema import BikaSchema -from bika.health.config import PROJECTNAME - -schema = BikaSchema.copy() -schema['description'].widget.visible = True -schema['description'].schemata = 'default' - -class CaseSyndromicClassification(BaseContent): - security = ClassSecurityInfo() - displayContentsTab = False - schema = schema - - _at_rename_after_creation = True - def _renameAfterCreation(self, check_auto_id=False): - from bika.lims.idserver import renameAfterCreation - renameAfterCreation(self) - -registerType(CaseSyndromicClassification, PROJECTNAME) +from AccessControl import ClassSecurityInfo +from Products.ATExtensions.ateapi import RecordsField +from DateTime import DateTime +from Products.ATExtensions.ateapi import DateTimeField, DateTimeWidget +from Products.Archetypes.public import * +from Products.CMFCore.permissions import View, ModifyPortalContent +from bika.lims import bikaMessageFactory as _b +from bika.health import bikaMessageFactory as _ +from bika.lims.content.bikaschema import BikaSchema +from bika.health.config import PROJECTNAME +from bika.lims.browser.widgets import RecordsWidget +from zope.interface import implements + +schema = BikaSchema.copy() +schema['description'].widget.visible = True +schema['description'].schemata = 'default' + +class CaseSyndromicClassification(BaseContent): + security = ClassSecurityInfo() + displayContentsTab = False + schema = schema + + _at_rename_after_creation = True + def _renameAfterCreation(self, check_auto_id=False): + from bika.lims.idserver import renameAfterCreation + renameAfterCreation(self) + +registerType(CaseSyndromicClassification, PROJECTNAME) diff --git a/bika/health/controlpanel/bika_casesyndromicclassifications.py b/bika/health/controlpanel/bika_casesyndromicclassifications.py index 473c889..218dcea 100644 --- a/bika/health/controlpanel/bika_casesyndromicclassifications.py +++ b/bika/health/controlpanel/bika_casesyndromicclassifications.py @@ -1,9 +1,12 @@ +from AccessControl.SecurityInfo import ClassSecurityInfo from Products.ATContentTypes.content import schemata from Products.Archetypes import atapi +from Products.Archetypes.ArchetypeTool import registerType from bika.lims.browser.bika_listing import BikaListingView from bika.health.config import PROJECTNAME from bika.lims import bikaMessageFactory as _b from bika.health import bikaMessageFactory as _ +from bika.lims.content.bikaschema import BikaFolderSchema from bika.health.interfaces import ICaseSyndromicClassifications from plone.app.layout.globals.interfaces import IViewView from plone.app.content.browser.interfaces import IFolderContentsView @@ -16,7 +19,7 @@ class CaseSyndromicClassificationsView(BikaListingView): def __init__(self, context, request): super(CaseSyndromicClassificationsView, self).__init__(context, request) self.catalog = 'bika_setup_catalog' - self.contentFilter = {'portal_type': 'CaseSyndromicClassifications', + self.contentFilter = {'portal_type': 'CaseSyndromicClassification', 'sort_on': 'sortable_title'} self.context_actions = {_('Add'): {'url': 'createObject?type_name=CaseSyndromicClassification', diff --git a/bika/health/controlpanel/configure.zcml b/bika/health/controlpanel/configure.zcml index deab6c1..241de2a 100644 --- a/bika/health/controlpanel/configure.zcml +++ b/bika/health/controlpanel/configure.zcml @@ -71,7 +71,7 @@ diff --git a/bika/health/profiles/default/cssregistry.xml b/bika/health/profiles/default/cssregistry.xml index 1662ece..d501e6c 100644 --- a/bika/health/profiles/default/cssregistry.xml +++ b/bika/health/profiles/default/cssregistry.xml @@ -3,7 +3,7 @@ + diff --git a/bika/health/profiles/default/metadata.xml b/bika/health/profiles/default/metadata.xml index 7b2c6a8..7a874c4 100644 --- a/bika/health/profiles/default/metadata.xml +++ b/bika/health/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 3004 + 3005 profile-bika.lims:default diff --git a/bika/health/profiles/default/structure/bika_setup/.preserve b/bika/health/profiles/default/structure/bika_setup/.preserve index 88f1059..5fd1898 100644 --- a/bika/health/profiles/default/structure/bika_setup/.preserve +++ b/bika/health/profiles/default/structure/bika_setup/.preserve @@ -1,5 +1,6 @@ bika_aetiologicagents bika_caseoutcomes +bika_casesyndromicclassifications bika_casestatuses bika_diseases bika_drugprohibitions diff --git a/bika/health/profiles/default/types/CaseSyndromicClassifications.xml b/bika/health/profiles/default/types/CaseSyndromicClassifications.xml index e02daaa..8e70270 100644 --- a/bika/health/profiles/default/types/CaseSyndromicClassifications.xml +++ b/bika/health/profiles/default/types/CaseSyndromicClassifications.xml @@ -14,7 +14,7 @@ False True - + False False diff --git a/bika/health/setupdata/__init__.py b/bika/health/setupdata/__init__.py index 449e757..8672eb0 100644 --- a/bika/health/setupdata/__init__.py +++ b/bika/health/setupdata/__init__.py @@ -1,4 +1,5 @@ from Products.CMFCore.utils import getToolByName +from Products.CMFPlone.utils import safe_unicode, _createObjectByType from bika.lims import logger from bika.lims.exportimport.dataimport import SetupDataSetList as SDL from bika.lims.exportimport.setupdata import WorksheetImporter @@ -35,6 +36,164 @@ def Import(self): renameAfterCreation(obj) +class Treatments(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_treatments + for row in self.get_rows(3): + obj = _createObjectByType('Treatment', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''), + Type=row.get('Type', 'active'), + Procedure=row.get('Procedure', ''), + Care=row.get('Care', ''), + SubjectiveClinicalFindings=row.get('SubjectiveClinicalFindings', ''), + ObjectiveClinicalFindings=row.get('ObjectiveClinicalFindings', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Aetiologic_Agents(WorksheetImporter): + + def get_subtypes(self): + sheetname = 'Aetiologic Agents Subtypes' + worksheet = self.workbook.get_sheet_by_name(sheetname) + if not worksheet: + return + subtypes = {} + rows = self.get_rows(3, worksheet=worksheet) + for row in rows: + ae_title = row['aetiologicagent_title'] + if ae_title not in subtypes.keys(): + subtypes[ae_title] = [] + subtypes[ae_title].append({'Subtype': row.get('Subtype', ''), + 'SubtypeRemarks': row.get('SubtypeRemarks', '')}) + return subtypes + + def Import(self): + subtypes = self.get_subtypes() + folder = self.context.bika_setup.bika_aetiologicagents + for row in self.get_rows(3): + obj = _createObjectByType('AetiologicAgent', folder, tmpID()) + obj = folder[_id] + if not row['title']: + continue + ae_title = row['title'] + ae_subtypes = subtypes.get(ae_title, []) + obj.edit(title=row['title'], + description=row.get('description', ''), + AetiologicAgentSubtypes=ae_subtypes) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Case_Syndromic_Classifications(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_casesyndromicclassifications + for row in self.get_rows(3): + obj = _createObjectByType('CaseSyndromicClassification', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Drugs(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_drugs + for row in self.get_rows(3): + obj = _createObjectByType('Drug', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''), + Category=row.get('Category', ''), + Indications=row.get('Indications', ''), + Posology=row.get('Posology', ''), + SideEffects=row.get('SideEffects', ''), + Preservation=row.get('Preservation', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Drug_Prohibitions(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_drugprohibitions + for row in self.get_rows(3): + obj = _createObjectByType('DrugProhibition', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Identifier_Types(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_identifiertypes + for row in self.get_rows(3): + obj = _createObjectByType('IdentifierType', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Immunizations(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_immunizations + for row in self.get_rows(3): + obj = _createObjectByType('Immunization', folder, tmpID()) + obj = folder[_id] + if row['title']: + obj.edit(title=row['title'], + description=row.get('description', ''), + Form=row.get('Form', 'active'), + RelevantFacts=row.get('RelevantFacts', ''), + GeographicalDistribution=row.get('GeographicalDistribution', ''), + Transmission=row.get('Transmission', ''), + Symptoms=row.get('Symptoms', ''), + Risk=row.get('Risk', ''), + Treatment=row.get('Treatment', ''), + Prevention=row.get('Prevention', ''),) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + +class Vaccination_Centers(WorksheetImporter): + + def Import(self): + folder = self.context.bika_setup.bika_vaccinationcenters + for row in self.get_rows(3): + obj = _createObjectByType("VaccinationCenter", folder, tmpID()) + if row['Name']: + obj.edit( + Name=row.get('Name', ''), + TaxNumber=row.get('TaxNumber', ''), + AccountType=row.get('AccountType', {}), + AccountName=row.get('AccountName', {}), + AccountNumber=row.get('AccountNumber', ''), + BankName=row.get('BankName', ''), + BankBranch=row.get('BankBranch', ''), + ) + self.fill_contactfields(row, obj) + self.fill_addressfields(row, obj) + obj.unmarkCreationFlag() + renameAfterCreation(obj) + + class Case_Outcomes(WorksheetImporter): def Import(self): diff --git a/bika/health/setupdata/configure.zcml b/bika/health/setupdata/configure.zcml index df49864..812583c 100644 --- a/bika/health/setupdata/configure.zcml +++ b/bika/health/setupdata/configure.zcml @@ -14,6 +14,54 @@ provides="bika.lims.interfaces.ISetupDataImporter" for="Products.CMFPlone.interfaces.IPloneSiteRoot"/> + + + + + + + + + + + + + + + + + diff --git a/bika/health/upgrade/to3005.py b/bika/health/upgrade/to3005.py new file mode 100644 index 0000000..43053f5 --- /dev/null +++ b/bika/health/upgrade/to3005.py @@ -0,0 +1,32 @@ +from Acquisition import aq_inner +from Acquisition import aq_parent +from Products.CMFCore import permissions +from Products.CMFCore.utils import getToolByName + + +def upgrade(tool): + """ HEALTH-105 Case syndromic classifications site eror in setup + """ + portal = aq_parent(aq_inner(tool)) + portal_catalog = getToolByName(portal, 'portal_catalog') + typestool = getToolByName(portal, 'portal_types') + setup = portal.portal_setup + setup.runImportStepFromProfile('profile-bika.health:default', 'typeinfo') + setup.runImportStepFromProfile('profile-bika.health:default', 'controlpanel') + setup.runImportStepFromProfile('profile-bika.health:default', 'factorytool') + setup.runImportStepFromProfile('profile-bika.health:default', 'propertiestool') + setup.runImportStepFromProfile('profile-bika.health:default', 'cssregistry') + + # Add CaseSyndromicClassification in bika_setup_catalog + portal = aq_parent(aq_inner(tool)) + at = getToolByName(portal, 'archetype_tool') + at.setCatalogsByType('CaseSyndromicClassification', ['bika_setup_catalog']) + + # Update bika_setup_catalog with old portal_catalog's CaseSyndr... + pc = getToolByName(portal, 'portal_catalog', None) + bsc = getToolByName(portal, 'bika_setup_catalog', None) + lpc = pc(portal_type="CaseSyndromicClassification") + for obj in lpc: + bsc.reindexObject(obj.getObject()) + + return True diff --git a/setup.py b/setup.py index 23f643a..4610f5f 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = '3.1.1' +version = '3.1.2' setup(name='bika.health', version=version, @@ -33,7 +33,7 @@ zip_safe=False, install_requires=[ 'setuptools', - 'bika.lims==3.1.1', + 'bika.lims==3.1.3', 'archetypes.schemaextender', 'collective.wtf', ],