Skip to content

Instantly share code, notes, and snippets.

@yitznewton
Created May 23, 2012 15:11
Show Gist options
  • Save yitznewton/2775809 to your computer and use it in GitHub Desktop.
Save yitznewton/2775809 to your computer and use it in GitHub Desktop.
Sample skeleton XML MOLO2 spec
<set name="provider">
<field name="id" sqlName="provider_id" />
<field name="display_title" />
<field name="gender" />
<sql>
SELECT
p.provider_id,
p.display_title,
p.gender
FROM
mdx_core.provider p
WHERE
provider_id = ?
</sql>
<set name="degree" groupBy="type_code">
<field name="type_name" />
<field name="type_code" sqlName="degree_code" />
<sql>
SELECT DISTINCT
pd.degree_code,
(SELECT
taxa.name
FROM
mdx_taxa.degree taxa
WHERE
taxa.degree_code = pd.degree_code) AS type_name
FROM
mdx_core.provider_degree pd
WHERE
pd.provider_id = ?
AND pd.record_status = 'A'
</sql>
<set name="source" groupBy="system_id">
<field name="system_id" sqlName="ins_plan_id" />
<field name="client_id" sqlName="input_source_ids" aggregate="true" />
<sql>
SELECT DISTINCT
null as system_id,
pd.input_source_ids,
FROM
mdx_core.provider_degree pd
WHERE
pd.provider_id = ?
AND pd.degree_code = ?
</sql>
<argument>provider.id</argument>
<argument>degree.type_code</argument>
</set>
</set>
<set name="assoc" groupBy="type_code">
<field name="type_code" />
<field name="title" />
<sql>
SELECT DISTINCT
pa.type_code,
pa.title
FROM
mdx_core.provider_association pa
INNER JOIN mdx_core.provider p USING (provider_id)
WHERE
pa.provider_id = ?
AND pa.record_status = 'A'
</sql>
</set>
<set name="specialty" groupBy="id">
<field name="id" sqlName="provider_field_specialty_id" />
<field name="name" sqlName="specialty_name" />
<field name="name_market" sqlName="market_name" />
<sql>
SELECT DISTINCT
pfs.provider_field_specialty_id,
fs.name,
fs.market_name
FROM
mdx_core.provider_field_specialty pfs
INNER JOIN mdx_taxa.field_specialty fs USING (field_specialty_id)
WHERE
pfs.provider_id = ?
AND pfs.record_status = 'A'
</sql>
<set name="identifier" groupBy="system_id">
<field name="type_code" />
<field name="system_id" sqlName="ins_plan_id" />
<field name="client_id" sqlName="input_source_ids" aggregate="true" />
<sql>
SELECT DISTINCT
null as type_code,
ppip.ins_plan_id,
pfs.input_source_ids,
FROM
mdx_core.provider_field_specialty pfs
LEFT JOIN mdx_core.provider_practice_ins_plan ppip USING (provider_practice_id)
WHERE
pfs.provider_id = ?
AND pfs.provider_field_specialty_id = ?
</sql>
<argument>provider.id</argument>
<argument>specialty.id</argument>
</set>
</set>
</set>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment