This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop child tables of intermediate aggregation tables. | |
# Each table must have a 'month' column. | |
# If tables have usage as reported by pg_stat_user_tables | |
# they will not be dropped. | |
import itertools | |
from datetime import date | |
from collections import defaultdict | |
from corehq.sql_db.connections import connection_manager | |
from sqlalchemy.exc import ProgrammingError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy_files: | |
- couch6: | |
- source_host: couch4 | |
source_user: couchdb | |
source_dir: /opt/data/couchdb2/ | |
target_dir: /opt/data/couchdb2/ | |
files: | |
- shards/00000000-1fffffff/commcarehq__fixtures.1495821829.couch | |
- .shards/00000000-1fffffff/commcarehq__fixtures.1495821829_design | |
- couch7: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casexml.apps.phone.tests.utils import call_fixture_generator | |
from corehq.apps.app_manager.fixtures.mobile_ucr import report_fixture_generator | |
from casexml.apps.phone.models import OTARestoreCommCareUser | |
from corehq.apps.users.models import CommCareUser | |
from corehq.apps.app_manager.models import Application | |
from datetime import date | |
import logging | |
from corehq.apps.app_manager.models import ReportModule | |
from corehq.apps.app_manager.fixtures.mobile_ucr import ReportFixturesProvider | |
import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://github.com/dhatim/python-license-check | |
import argparse | |
try: | |
from configparser import ConfigParser, NoOptionError | |
except ImportError: | |
from ConfigParser import ConfigParser, NoOptionError | |
import re | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cchq icds-cas run-shell-command couchdb2 -b "service couchdb2 stop && rm -rf /opt/data/couchdb2/* && rm -f /usr/local/couchdb2/couchdb/etc/local.d/z_admin.ini && rm -f /usr/local/couchdb2/couchdb/etc/local.d/auto_gen.ini && > /usr/local/couchdb2/couchdb/etc/local.d/ssl.ini && service couchdb2 start" | |
cchq icds-cas ap deploy_db.yml --limit couchdb2 --branch=je/icds-cas-deploy --skip-check --start-at-task="Create system databases" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cStringIO | |
import json | |
import psycopg2 | |
from django.db import connections | |
from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer | |
from corehq.form_processor.models import CommCareCaseSQL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dimagi.utils.chunked import chunked | |
from corehq.apps.locations.dbaccessors import user_ids_at_locations | |
from corehq.apps.es.aggregations import * | |
from corehq.apps.es import FormES | |
from corehq.apps.locations.models import * | |
from elasticsearch.exceptions import * | |
from iso8601 import iso8601 | |
domain = 'domain' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import datetime | |
import os | |
from datadog import initialize, api | |
from collections import defaultdict | |
options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop function if exists make_new_user(TEXT); | |
create function make_new_user(p_username TEXT, user_id OUT INTEGER ) as $$ | |
begin | |
INSERT INTO users (username, shard, last_updated) VALUES (p_username, (hashtext(p_username)&15), now()) | |
RETURNING users.user_id INTO user_id; | |
end; | |
$$ language plpgsql; | |
drop function if exists get_all_users_with_db(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from errand_boy.transports.unixsocket import UNIXSocketTransport | |
from subprocess import PIPE | |
form = """<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:vellum="http://commcarehq.org/xforms/vellum">\n\t<h:head>\n\t\t<h:title>Newborn Treatment</h:title>\n\t\t<model>\n\t\t\t<instance>\n\t\t\t\t<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/1904f15bf570b2e0169690416432f6103621b155" uiVersion="1" version="1" name="Newborn Treatment">\n\t\t\t\t\t<debug>\n\t\t\t\t\t\t<classification_infection_debug/>\n\t\t\t\t\t\t<classification_poids_debug/>\n\t\t\t\t\t\t<classification_occular_debug/>\n\t\t\t\t\t\t<classification_vih_debug/>\n\t\t\t\t\t\t<classification_malnutrition_debug/>\n\t\t\t\t\t\t<alimentation_qc_debug/>\n\t\t\t\t\t\t<alimentation_qd_debug/>\n\t\t\t\t\t\t<alimentation_qf_debug/>\n\t\t\t\t\t\t<a |