merged script MPR July_Anc_Money Receipt

WITH date_range AS (
    SELECT
        DATE '2026-07-01' AS start_date,
        DATE '2026-07-31' AS end_date
),
 
-- 1. Pregnant Mothers
pregnant_mothers AS (
    SELECT
        b.id AS branch_id,
        b.name AS branch_name,
        COALESCE(COUNT(DISTINCT poa.base_entity_id), 0) AS pregnant_mothers
    FROM core.branch b
    LEFT JOIN report.anc_register poa
        ON poa.branch_id::int = b.id
       AND poa.date_created BETWEEN (SELECT start_date FROM date_range)
                        

refered patient

WITH date_range AS (
    SELECT DATE '2026-08-01' AS start_date,
           DATE '2026-08-31' AS end_date
),

base AS (
    SELECT
        rl.id AS refer_id,
        rl.base_entity_id,
        m.first_name AS patient_name,
        m.patient_phone_number AS mobile_number,
        TRIM(TO_CHAR(rl.date_created, 'Month')) AS month,
        DATE(rl.date_created) AS refer_date,
        rl.date_created,

        CASE
            WHEN rl.provider_id = 'FA_Threads_Palashbari_3' THEN 'Sham

Threads Calculated with refund amonut

WITH
-- ============================================================
-- CHANGE THE REPORT DATE RANGE HERE ONLY -- everything below
-- (Part A and Part B) reads from this single place.
-- ============================================================
date_range AS (
    SELECT
        DATE '2026-06-01' AS start_date,
        DATE '2026-08-31' AS end_date
),

anc_dedup AS (
    SELECT base_entity_id, MIN(date_created) AS anc_date
    FROM report.anc_register
    GROUP BY base_entity_id

Refered and Service Patient Details

WITH
-- ============================================================
-- CHANGE THE REPORT DATE RANGE HERE ONLY -- applies to BOTH
-- the referral side and the service side.
-- ============================================================
date_range AS (
    SELECT DATE '2026-08-01' AS start_date,
           DATE '2026-08-31' AS end_date
),

-- ============================================================
-- REFERRAL SIDE
-- ============================================================

Refered and Service query for email

WITH
date_range AS (
    SELECT DATE '2026-09-01' AS start_date,
           DATE '2026-09-30' AS end_date
),

referral_events AS (
    SELECT
        rl.base_entity_id,
        DATE(rl.date_created) AS refer_date
    FROM report.refer_list rl
    WHERE rl.provider_id IN (
            'FA_Threads_Palashbari_3','FA_Threads_Palashbari_4','FA_Threads_Palashbari_5',
            'FA_Threads_Ashulia_1','FA_Threads_Ashulia_3','FA_Threads_Ashulia_4',
            'FA_Threads_Ashulia_5','FA_Threads_Palashb

1807. Evaluate the Bracket Pairs of a String

You are given a string s that contains some bracket pairs, with each pair containing a non-empty key. For example, in the string "(name)is(age)yearsold", there are two bracket pairs that contain the keys "name" and "age". You know the values of a wide range of keys. This is represented by a 2D string array knowledge where each knowledge[i] = [keyi, valuei] indicates that key keyi has a value of valuei. You are tasked to evaluate all of the bracket pairs. When you evaluate a bracket pair that contains some key keyi, you will: Replace keyi and the bracket pair with the key's corresponding valuei. If you do not know the value of the key, you will replace keyi and the bracket pair with a question mark "?" (without the quotation marks). Each key will appear at most once in your knowledge. There will not be any nested brackets in s. Return the resulting string after evaluating all of the bracket pairs.
/**
 * @param {string} s
 * @param {string[][]} knowledge
 * @return {string}
 */
var evaluate = function(s, knowledge) {
    // Convert knowledge into a Map:
    // [["name", "bob"], ["age", "two"]]
    // becomes:
    // name -> bob
    // age  -> two
    const map = new Map(knowledge);

    const result = [];
    let i = 0;

    while (i < s.length) {

        // If we find an opening bracket,
        // we need to extract the key inside it.
        if (s[i] === "(") {
            let j = i +

Disable Visual Tab Wordpress

add_filter('wp_editor_settings', function ($settings) {
    $settings['quicktags'] = true;
    $settings['tinymce'] = false;
    return $settings;
});

1096. Brace Expansion II

Under the grammar given below, strings can represent a set of lowercase words. Let R(expr) denote the set of words the expression represents. The grammar can best be understood through simple examples: Single letters represent a singleton set containing that word. R("a") = {"a"} R("w") = {"w"} When we take a comma-delimited list of two or more expressions, we take the union of possibilities. R("{a,b,c}") = {"a","b","c"} R("{{a,b},{b,c}}") = {"a","b","c"} (notice the final set only contains each word at most once) When we concatenate two expressions, we take the set of possible concatenations between two words where the first word comes from the first expression and the second word comes from the second expression. R("{a,b}{c,d}") = {"ac","ad","bc","bd"} R("a{b,c}{d,e}f{g,h}") = {"abdfg", "abdfh", "abefg", "abefh", "acdfg", "acdfh", "acefg", "acefh"} Formally, the three rules for our grammar: For every lowercase letter x, we have R(x) = {x}. For expressions e1, e2, ... , ek with k >= 2, we have R({e1, e2, ...}) = R(e1) ∪ R(e2) ∪ ... For expressions e1 and e2, we have R(e1 + e2) = {a + b for (a, b) in R(e1) × R(e2)}, where + denotes concatenation, and × denotes the cartesian product. Given an expression representing a set of words under the given grammar, return the sorted list of words that the expression represents.
/**
 * @param {string} expression
 * @return {string[]}
 */
var braceExpansionII = function(expression) {

    // Helper: concatenates two sets of strings (cartesian product)
    function concat(set1, set2) {
        // If one side is empty, concatenation behaves like the other side
        if (set1.size === 0) return set2;
        if (set2.size === 0) return set1;

        const res = new Set();
        for (let a of set1) {
            for (let b of set2) {
                res.add(a + b); // c

Rename a Branch locally and globally

git checkout x
git branch -m y
git push -u origin y
git push origin --delete x
git fetch --prune

Transfer uncommited changes from one Branch to another

# On branch x
git stash
# Switch to target branch
git checkout y
# Apply saved changes
git stash pop
git add .
git commit -m"x to y"

gistfile1.txt

gist -P

tutorial redis con docker


Bajo la imagen alpine para que ocupe menos

docker pull redis:alpine3.19

corro el contenedor, si quiero que sea como demonio agrego -d

docker run --name mi_redis -p 6379:6379 redis:alpine3.19


para conectar con el docker en linea de comando como es alpine es asi:

docker exec -it mi_redis sh

para entrar al cli del redis

redis-cli

Ahora puedo ejecutar consultas en el redis

muestro todas las claves
keys *

creo una clave
set saludo "Hola soy Flash desde Redis"

consulto una clave
get salud

3550. Smallest Index With Digit Sum Equal to Index

You are given an integer array nums. Return the smallest index i such that the sum of the digits of nums[i] is equal to i. If no such index exists, return -1.
/**
 * @param {number[]} nums
 * @return {number}
 */
var smallestIndex = function(nums) {
    // Helper function to compute the digit sum of a number
    const digitSum = (x) => {
        let sum = 0;
        // Extract digits one by one
        while (x > 0) {
            sum += x % 10;          // Add last digit
            x = Math.floor(x / 10); // Remove last digit
        }
        return sum;
    };

    // Scan from left to right to find the smallest index
    for (let i = 0; i < nums.l

1658. Minimum Operations to Reduce X to Zero

You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its value from x. Note that this modifies the array for future operations. Return the minimum number of operations to reduce x to exactly 0 if it is possible, otherwise, return -1.
/**
 * @param {number[]} nums
 * @param {number} x
 * @return {number}
 */
var minOperations = function(nums, x) {
    // Total sum of the array
    const total = nums.reduce((a, b) => a + b, 0);

    // We want to KEEP a subarray whose sum is total - x.
    // Everything outside that subarray is removed.
    const target = total - x;

    // If target is 0, we must remove all elements.
    if (target === 0) return nums.length;

    let left = 0;
    let curr = 0;
    let maxLen = -1; // longest

3525. Find X Value of Array II

You are given an array of positive integers nums and a positive integer k. You are also given a 2D array queries, where queries[i] = [indexi, valuei, starti, xi]. You are allowed to perform an operation once on nums, where you can remove any suffix from nums such that nums remains non-empty. The x-value of nums for a given x is defined as the number of ways to perform this operation so that the product of the remaining elements leaves a remainder of x modulo k. For each query in queries you need to determine the x-value of nums for xi after performing the following actions: Update nums[indexi] to valuei. Only this step persists for the rest of the queries. Remove the prefix nums[0..(starti - 1)] (where nums[0..(-1)] will be used to represent the empty prefix). Return an array result of size queries.length where result[i] is the answer for the ith query. A prefix of an array is a subarray that starts from the beginning of the array and extends to any point within it. A suffix of an array is a subarray that starts at any point within the array and extends to the end of the array. Note that the prefix and suffix to be chosen for the operation can be empty. Note that x-value has a different definition in this version.
/**
 * @param {number[]} nums
 * @param {number} k
 * @param {number[][]} queries
 * @return {number[]}
 */
var resultArray = function(nums, k, queries) {
    const n = nums.length;

    // Node structure:
    // {
    //   freq: Array(k).fill(0),
    //   total: number (product % k)
    // }

    // Build segment tree
    const size = 1 << (Math.ceil(Math.log2(n)) + 1);
    const tree = Array(size);

    function build(idx, l, r) {
        if (l === r) {
            const val = nums[l] % k;
   

SOC

# Systèmes d'organisation des connaissances pour bases interrogeables par des agents IA

*Illustré par le domaine de l'octroi de crédit*

---

## 1. La thématique : les systèmes d'organisation des connaissances (SOC)

### 1.1 Définition

Un **système d'organisation des connaissances** (SOC, en anglais *Knowledge Organization System*, KOS) est un dispositif explicite et gouverné qui fixe **le vocabulaire d'un domaine, les relations entre ses termes, et éventuellement les règles qui contraignent c