Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from datetime import datetime
- from conf.celery import CELERY
- from elasticsearch import Elasticsearch
- from pymongo import MongoClient
- LOGGING_LOCATION = 'logs/python_service'
- # ************** ES QUERY GEN CONFIG START ************************
- START_YEAR = 1800
- END_YEAR = datetime.now().year
- SYNONYMS_ES_INDEX = 'synonyms_master'
- # SYNONYMS_MONGO_IP = '10.240.0.42'
- # SYNONYMS_MONGO_IP = '104.196.144.163'
- # SYNONYMS_MONGO_PORT = 27017
- # SYNONYMS_MONGO_DB = 'jan21_disjoint_sets_uniqueid'
- # SYNONYMS_MONGO_COLLECTIONS = {'disease': 'disease_v2',
- # 'gene': 'gene_v2',
- # 'protein': 'protein_v2',
- # 'drug': 'drug',
- # 'others': 'others_v2'}
- forword_data_sets = {
- "clinicaltrials": {
- "forward_index": "ct_new",
- "forward_doc_type": "sample_data"
- },
- "aggregatedtrials": {
- "forward_index": "ct_aggregated",
- "forward_doc_type": "sample_data"
- },
- "congresses": {
- "forward_index": "congresses_new",
- "forward_doc_type": "sample_data"
- },
- "publications": {
- "forward_index": "pubmed_new",
- "forward_doc_type": "sample_data"
- },
- "thesis": {
- "forward_index": "thesis_new",
- "forward_doc_type": "sample_data"
- },
- "author": {
- "forward_index": "author_data",
- "forward_doc_type": "sample_data"
- },
- "patent": {
- "forward_index": "patents",
- "forward_doc_type": "sample_data"
- },
- "recent_events": {
- "forward_index": "pharma_blog",
- "forward_doc_type": "sample_data"
- },
- "grants": {
- "forward_index": "grants",
- "forward_doc_type": "sample_data"
- },
- "guidelines": {
- "forward_index": "guidelines",
- "forward_doc_type": "sample_data"
- }
- }
- gene_type_query = {
- "index": "gene_view_test",
- "type": "sample_data",
- "body": {
- "query": {
- "term": {
- "unique_id": ""
- }
- }
- },
- "_source": [
- "type_of_gene"
- ]
- }
- DATA_SET_FIELDS = {
- "clinicaltrials": [
- "overall_status",
- "public_title",
- "scientific_title",
- "official_title",
- "clinical_id",
- "condition",
- "intervention.intervention_name",
- "keyword",
- "condition_mesh_terms",
- "tagger_terms.Pharmacological_substance",
- "tagger_terms.Disease",
- "tagger_terms.Gene",
- "tagger_terms.Protein",
- "required_header.url",
- "study_results"
- ],
- "aggregatedtrials": [
- "aggregated_data.recruitment_status",
- "also_published_as_mapping",
- "public_title",
- "scientific_title",
- "official_title",
- "clinical_id",
- "also_published_as",
- "condition",
- "intervention.intervention_name",
- "keyword",
- "condition_mesh_terms",
- "tagger_terms.Pharmacological_substance",
- "tagger_terms.Disease",
- "tagger_terms.Gene",
- "tagger_terms.Protein",
- "required_header.url",
- "update_label_ts",
- "study_results"
- ],
- "congresses": [
- "congress_id",
- "congress_name",
- "year",
- "title",
- "author_names",
- "tagger_terms.Pharmacological_substance",
- "tagger_terms.Disease",
- "tagger_terms.Gene",
- "tagger_terms.Protein",
- "link",
- "update_label_ts"
- ],
- "publications": [
- "journal_title",
- "article_title",
- "author_names",
- "tagger_terms.Pharmacological_substance",
- "tagger_terms.Disease",
- "tagger_terms.Gene",
- "tagger_terms.Protein",
- "pub_date",
- "year_str",
- "pmid",
- "update_label_ts",
- "created_at",
- "required_header.url",
- "source"
- ],
- "thesis": [
- "tid",
- "url",
- "data.title",
- "data.publisher",
- "data.abstract",
- "data.author",
- "data.date",
- "data.source",
- "data.committee",
- "data.type",
- "tagger_terms.Pharmacological_substance",
- "tagger_terms.Disease",
- "tagger_terms.Gene",
- "tagger_terms.Protein",
- "update_label_ts"
- ],
- "patent": [
- "patent_id",
- "title",
- "abstract",
- "claims",
- "standard_assignee",
- "priority_date",
- "feeStatus",
- "country",
- "update_label_ts"
- ],
- "recent_events": [
- "author",
- "title",
- "link",
- "date",
- "source",
- "unique_id",
- "created_at"
- ],
- "grants": [
- "grant_id",
- "title",
- "url",
- "institution",
- "amount",
- "grant_type",
- "startyear",
- "endyear",
- "pi",
- "year",
- "created_at"
- ],
- "guidelines": [
- "authors",
- "title",
- "link",
- "url",
- "date",
- "affiliation",
- "uuid",
- "created_at"
- ]
- }
- SEARCH_FIELDS = {
- "clinicaltrials": [
- "all_fields",
- "detailed_description",
- "public_title",
- "official_title",
- "keyword",
- "condition",
- "scientific_title",
- "intervention.description",
- "intervention.intervention_name",
- "authors.author_id"
- ],
- "aggregatedtrials": [
- "all_fields",
- "detailed_description",
- "public_title",
- "official_title",
- "keyword",
- "condition",
- "scientific_title",
- "intervention.description",
- "intervention.intervention_name",
- "authors.author_id"
- ],
- "congresses": [
- "all_fields",
- "abstract",
- "title",
- "authors.author_id"
- ],
- "publications": [
- "all_fields",
- "abstract",
- "article_title",
- "keywords",
- "authors.author_id"
- ],
- "thesis": [
- "all_fields",
- "data.abstract",
- "data.title",
- "authors.author_id"
- ],
- "patent": [
- "all_fields",
- "abstract",
- "title",
- "claims",
- ""
- ],
- "recent_events": [
- "all_fields",
- "desc",
- "title",
- ""
- ],
- "grants": [
- "all_fields",
- "abstract",
- "title",
- ""
- ],
- "guidelines": [
- "all_fields",
- "abstract",
- "title",
- ""
- ]
- }
- AGGREGATION_QUERY_FIELDS = {
- "protein": {
- "include": "PROT_.*"
- },
- "gene": {
- "include": "GENE_.*"
- },
- "indication": {
- "include": "DISE_.*"
- },
- "intervention": {
- "include": "DRUG_.*"
- },
- "technology_ivf": {
- "include": "TECHIVF_.*",
- "exclude": (".*49|.*623|.*441|.*367|.*222|.*566|.*482|.*650|.*314|"
- ".*556|.*19|.*613|.*134|.*242|.*651|.*521|.*548|.*459|"
- ".*243|.*476|.*387|.*596|.*505|.*203|.*588|.*506|.*370")
- },
- "product_ivf": {
- "include": "PRODIVF_.*"
- },
- "sponsor": {
- "field": "sponsors.lead_sponsor.agency"
- }
- }
- FUNCTION_QUERY_FIELDS = {
- "clinicaltrials": "start_year",
- "aggregatedtrials": "start_year",
- "congresses": "year",
- "publications": "year_str",
- "thesis": "year",
- "patent": "year_str",
- "recent_events": "year",
- "grants": "year",
- "guidelines": "year"
- }
- HIGHLIGHT_FIELDS = ['Gene', 'Drug', 'Protein', 'Disease']
- HIGHLIGHT_DATA_FIELDS = {'publications': ['abstract', 'article_title'],
- 'clinicaltrials': ['public_title'],
- 'aggregatedtrials': ['public_title'],
- 'congresses': ['abstract', 'title'],
- 'thesis': ['data.abstract', 'data.title'],
- 'patent': ['abstract', 'title', 'claims'],
- 'recent_events': ['title'],
- 'grants': ['title', 'abstract'],
- 'guidelines': ['title', 'abstract']
- }
- # ************** ES QUERY GEN CONFIG END ************************
- # ******** Workspace Setting **********
- TASK_EXEC_DAY = 'Sunday'
- # UTC time (9:00AM)IST -- (4:30AM)CET -- (3:30AM) UTC
- TASK_EXEC_TIME = {"hour": 3, "minute": 30}
- # UTC time (11:0OPM)IST -- (6:30PM)CET -- (5:30PM) UTC
- CLUSTER_EXEC_TIME = {"hour": 6, "minute": 52}
- WORKSPACE_URL = '/#!/workspace/glance'
- WORKSPACE_CLUSTER_URL = '/#!/workspace/monitorclusters/{cluster_name}/{cluster_query}/{cluster_id}/publications/latest/0,0/all/1'
- # SES config for email
- MAIL_SERVER = "us-east-1"
- MAIL_PORT = 587
- MAIL_USE_TLS = True
- MAIL_USERNAME = "AKIAIB6BUWAPXCQAP6EA"
- MAIL_PASSWORD = "1ZAZdjx6/RRVeJBp/bAh2yvovUnQ/EtXrRuNo1pU"
- MAIL_DEFAULT_SENDER = "iPlexus <noreply@appsupport.innoplexus.de>"
- def set_python_paths(paths):
- paths = paths if isinstance(paths, list) else [paths]
- sys.path.extend(paths)
- def get_es_cluster_instance(es_ips):
- es_ips = es_ips if isinstance(es_ips, list) else [es_ips]
- return Elasticsearch(es_ips)
- def get_mongo_instance(MONGO_URL, m_db):
- mongo_cli = MongoClient(MONGO_URL)
- mongo_cli = mongo_cli[m_db]
- return mongo_cli
- def get_workspace_url(base_url):
- return '%s%s' % (base_url, WORKSPACE_URL)
- def get_workspace_cluster_url(base_url):
- return '%s%s' % (base_url, WORKSPACE_CLUSTER_URL)
- # ******** Bplexus configuration **********
- DATASET_FIELDS = {
- 'drugs': {
- 'id': 'name_id',
- 'name': 'name',
- 'synonym_name': 'synonyms',
- 'unique_id': 'unique_id',
- 'target_name': 'target_synonyms',
- 'active_ingredient': 'active_ingredient',
- 'source': 'regulatory_body',
- 'status': 'status',
- 'type': 'type',
- 'innoplexus_id': 'innoplexus_id'
- },
- 'alerts': {
- 'title': 'title',
- 'date': 'timestamp',
- 'link': 'link',
- 'source': 'source',
- 'innoplexus_id': 'innoplexus_id'
- },
- 'press_releases': {
- 'title': 'title',
- 'date': 'created_at',
- 'link': 'source_url',
- 'source': 'source'
- }
- }
- DAC_REPORTS_MAPPINGS = {
- 'multiple sclerosis': 'Peripheral and Central Nervous System',
- 'alzheimer disease': 'Peripheral and Central Nervous System',
- 'epilepsy': 'Peripheral and Central Nervous System',
- 'parkinson disease': 'Peripheral and Central Nervous System',
- 'stroke': 'Peripheral and Central Nervous System',
- 'breast cancer': 'Oncologic Drugs Advisory Committee',
- 'acute lymphoblastic leukemia': 'Oncologic Drugs Advisory Committee',
- 'ovarian diseases': 'ovarian',
- 'male infertility': 'male infertility',
- 'female infertility': 'female infertility',
- 'diabetes': 'Endocrinologic and Metabolic',
- 'obesity': 'Endocrinologic and Metabolic',
- 'thyroid disorders': 'Endocrinologic and Metabolic',
- }
- PRESS_RELEASES_SOURCES = {
- 'fda': ['FDA', 'FDA Voice', 'FDA Feeds'],
- 'ema': ['EMA'],
- 'canada': ['canada', 'health_canada'],
- 'health canada': ['canada', 'health_canada'],
- 'jpa': ['jpa'],
- 'others': [
- "FiercePharma", "PR Newswire", "pharmamanufacturing", "GEN News", "FierceBiotech",
- "Merck Newsroom", "Pfizer", "drugstorenews", "PharmaIQ", "news_medical_net", "prlogHealth",
- "pharmacyToday", "worldpharma", "pharmabiz.com", "drugtopics", "outsourcing-pharma",
- "PharmaTimes", "prlogMedical", "biopharma-reporter", "prlog", "dddmag", "contractpharma",
- "pharmacytimes", "uspharmacist", "PharmaVOICE.com", "businesswireScience", "prlogScience",
- "ipprolifesciences", "globenewswire.com"],
- 'all': None,
- 'anmat': ['ANMAT'],
- 'anvisa': ['ANVISA'],
- 'chile' : ['Instituto de Salud Publica de Chile']
- }
- # TRIAL_STATUS_MAPPINGS = {
- # 'In Progress': ["Approved for marketing", "Authorised", "Available", "Enrolling by invitation",
- # "Recruiting", "Registered", "Recruiting complete, follow-up continuing",
- # "Recruiting ongoing", "open: patient inclusion", "Ongoing",
- # "Recruiting complete, follow-up complete", "Open public recruiting", "Pending",
- # "Closed to Recruitment of Participants", "Restarted", "No longer recruiting",
- # "Preinitiation", "recruitement status not public", "Other"],
- # 'Not Active': ["No longer available", "Stopped", "Stopped early", "Suspended",
- # "Temporarily not available", "Terminated", "Unknown status", "Withdrawn", "Withheld",
- # "Temporarily Closed", "Suspended by CA", "Prematurely Ended", "Other (Terminated)",
- # "Recruiting withdrawn before recruiting started", "Temporarily Halted", "Suspending",
- # "Recruiting suspended on temporary hold", "Not Applicable", "Not Authorised",
- # "Not Available", "Recruiting stopped after recruiting started", "Prohibited by CA"],
- # 'Completed': ["Closed: follow-up complete", "Closed: follow-up continuing", "Completed",
- # "Complete", "stopped: trial finished", "Main results already published"],
- # 'New Trials': ["planned", "Not yet recruiting", "Active, not recruiting", "Not Recruiting",
- # "Not recruiting", "Open to Recruitment", "Not Yet Recruiting",
- # "Recruiting planned"]
- # }
- TRIAL_STATUS_MAPPINGS = {
- 'New Trials': [
- 'planned', 'Not yet recruiting', 'Open to Recruitment', 'Reclutando',
- 'Not Yet Recruiting', 'Recruiting planned', 'Recruiting',
- ],
- 'In Progress': [
- 'Authorised', 'Available', 'Enrolling by invitation', 'Registered',
- 'Recruiting complete', 'follow-up continuing', 'Recruiting ongoing',
- 'open: patient inclusion', 'Ongoing', 'Recruiting complete',
- 'follow-up complete', 'Open public recruiting',
- 'Closed to Recruitment of Participants', 'Restarted',
- 'No longer recruiting', 'Preinitiation', 'recruitement status not public',
- 'Active, not recruiting', 'Not Recruiting', 'Not recruiting',
- ],
- 'Not Active': [
- 'Pending', 'Other', 'No longer available', 'Stopped', 'Stopped early',
- 'Suspended', 'Temporarily not available', 'Terminated', 'Unknown status',
- 'Withdrawn', 'Withheld', 'Temporarily Closed', 'Suspended by CA', 'Otro',
- 'Prematurely Ended', 'Other (Terminated)', 'Prohibited by CA', 'Suspendido',
- 'Recruiting withdrawn before recruiting started', 'Temporarily Halted',
- 'Suspending', 'Recruiting suspended on temporary hold', 'Not Applicable',
- 'Not Available', 'Recruiting stopped after recruiting started',
- ],
- 'Completed': [
- 'Closed: follow-up complete', 'Closed: follow-up continuing', 'Completed',
- 'Complete', 'stopped: trial finished', 'Main results already published',
- 'Approved for marketing', 'Not Authorised', 'Finalizado',
- ]
- }
- PIE_CHART_RESULT = [
- {
- 'category': 'Completed',
- 'value': 0
- }, {
- 'category': 'Not Active',
- 'value': 0
- }, {
- 'category': 'In Progress',
- 'value': 0
- }, {
- 'category': 'New Trials',
- 'value': 0
- }
- ]
- DRUG_STATUS_MAPPINGS = {
- 'fda': {
- 'accelerated_approval': 'Accelerated approvals',
- 'nme': 'New molecular entities',
- 'fast_track': 'Fast track approvals',
- 'breakthrough_approval': 'Breakthrough approvals',
- 'priority_review': 'Priority reviews',
- 'orphan_approval': 'Orphan approvals',
- 'Prescription': 'Prescription',
- 'Discontinued': 'Discontinued',
- 'Over-the-counter': 'Over the counter',
- 'Tentative Approval': 'Tentative Approval'
- },
- 'ema': {
- 'Authorised': 'Authorised',
- 'Refused': 'Refused',
- 'Withdrawn': 'Withdrawn',
- 'Suspended': 'Suspended',
- 'Pending (Positive Opinion)': 'Pending',
- 'Pending (Negative Opinion)': 'Pending',
- 'Referred': 'Referred',
- 'paediatric_approval': 'Paediatrics',
- 'orphan_approval': 'Orphan approvals'
- },
- 'health canada': {},
- 'all': {},
- 'others': {}
- }
- MS_FILTERED_DRUGS = ['DRUG_ID_d28920e3353da9ae7afa319647874947d02fd74c']
- REPRODUCTIVE_EXCLUDED_TERMS = ['Carcinoma', 'Neoplasms', 'Malignant Neoplasms',
- 'Malignant neoplasm of ovary']
- PHASE_MAPPINGS = {
- "Phase 0": ["Phase 0"],
- "Phase 1": ["Phase 1"],
- "Phase 2": ["Phase 2", "Phase 2-3", "Phase 1 / Phase 2", "Phase 1-2",
- "Phase 2 / Phase 3", "Phase 3 / Phase 4"],
- "Phase 3": ["Phase 3"],
- "Phase 4": ["Phase 4"],
- "Others": ["Others", "N/A", "Not Applicable"],
- "All Phases": ["Phase 0", "Phase 1", "Phase 2", "Phase 3", "Phase 4", "Phase 2-3",
- "Phase 1 / Phase 2", "Phase 1-2", "Phase 2 / Phase 3", "Phase 3 / Phase 4",
- "Others", "N/A", "Not Applicable"]
- }
- COUNTRY = {
- 'fda': 'US',
- 'ema': 'EU',
- 'others': '',
- 'canada': 'CANADA',
- 'health canada': 'CANADA',
- 'jpa': 'JAPAN',
- 'instituto de salud publica de chile': 'Chile',
- 'chile': 'Chile',
- 'anmat': 'Argentina',
- 'anvisa': 'Brazil'
- }
- SOURCE_MAPPINGS = {
- 'fda': 'fda',
- 'ema': 'ema',
- 'canada': 'health canada',
- 'health canada': 'health canada',
- 'jpa': 'jpa',
- 'instituto de salud publica de chile': 'chile',
- 'anmat': 'anmat',
- 'anvisa': 'anvisa',
- 'chile': 'chile'
- }
- LABEL_CHANGES_RESPONSES = {
- 'ema': {
- 'smpc': {
- 'label_type': 'smpc',
- 'displayName': 'SmPC',
- 'data': []
- },
- 'labelling': {
- 'label_type': 'labelling',
- 'displayName': 'Labelling',
- 'data': []
- },
- 'pl': {
- 'label_type': 'pl',
- 'displayName': 'Package Leaflet',
- 'data': []
- },
- 'annex': {
- 'label_type': 'annex',
- 'displayName': 'Annex-II',
- 'data': []
- }
- },
- 'fda': {
- 'adverse_reactions': {
- 'label_type': 'adverse_reactions',
- 'displayName': 'Adverse reactions',
- 'data': []
- },
- 'boxed_warning': {
- 'label_type': 'boxed_warning',
- 'displayName': 'Boxed warning',
- 'data': []
- },
- 'warnings': {
- 'label_type': 'warnings',
- 'displayName': 'Warnings',
- 'data': []
- },
- 'precautions': {
- "label_type": "precautions",
- "displayName": "Precautions",
- "data": []
- },
- 'contraindications': {
- 'label_type': 'contraindications',
- 'displayName': 'Contraindications',
- 'data': []
- }
- },
- 'health canada': {
- 'adverse_reactions': {
- 'label_type': 'adverse_reactions',
- 'displayName': 'Adverse reactions',
- 'data': []
- },
- 'boxed_warning': {
- 'label_type': 'boxed_warning',
- 'displayName': 'Boxed warning',
- 'data': []
- },
- 'warnings': {
- 'label_type': 'warnings',
- 'displayName': 'Warnings',
- 'data': []
- },
- 'precautions': {
- "label_type": "precautions",
- "displayName": "Precautions",
- "data": []
- },
- 'contraindications': {
- 'label_type': 'contraindications',
- 'displayName': 'Contraindications',
- 'data': []
- }
- },
- 'canada': {
- 'adverse_reactions': {
- 'label_type': 'adverse_reactions',
- 'displayName': 'Adverse reactions',
- 'data': []
- },
- 'boxed_warning': {
- 'label_type': 'boxed_warning',
- 'displayName': 'Boxed warning',
- 'data': []
- },
- 'warnings': {
- 'label_type': 'warnings',
- 'displayName': 'Warnings',
- 'data': []
- },
- 'precautions': {
- "label_type": "precautions",
- "displayName": "Precautions",
- "data": []
- },
- 'contraindications': {
- 'label_type': 'contraindications',
- 'displayName': 'Contraindications',
- 'data': []
- }
- }
- }
Add Comment
Please, Sign In to add comment