The following query contains the coverage for mapped source vocabularies in the Drug domains to RxNorm.
select tbl as table, clmn as column_name, tbl_concept_id, CONCEPT_ID as concept_id, concept_name, vocabulary_id, count(1)::integer as "count" from (
select 'PERSON' as tbl, 'GENDER_CONCEPT_ID' as clmn, gender_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (gender_concept_id = CONCEPT_ID)
union all select 'PERSON' as tbl, 'RACE_CONCEPT_ID' as clmn, race_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (race_concept_id = CONCEPT_ID)
union all select 'PERSON' as tbl, 'ETHNICITY_CONCEPT_ID' as clmn, ethnicity_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (ethnicity_concept_id = CONCEPT_ID)
union all select 'PERSON' as tbl, 'GENDER_SOURCE_CONCEPT_ID' as clmn, gender_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (gender_source_concept_id = CONCEPT_ID)
union all select 'PERSON' as tbl, 'RACE_SOURCE_CONCEPT_ID' as clmn, race_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (race_source_concept_id = CONCEPT_ID)
union all select 'PERSON' as tbl, 'ETHNICITY_SOURCE_CONCEPT_ID' as clmn, ethnicity_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PERSON left join concept on (ethnicity_source_concept_id = CONCEPT_ID)
union all select 'OBSERVATION_PERIOD' as tbl, 'PERIOD_TYPE_CONCEPT_ID' as clmn, period_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION_PERIOD left join concept on (period_type_concept_id = CONCEPT_ID)
union all select 'VISIT_OCCURRENCE' as tbl, 'VISIT_CONCEPT_ID' as clmn, visit_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_OCCURRENCE left join concept on (visit_concept_id = CONCEPT_ID)
union all select 'VISIT_OCCURRENCE' as tbl, 'VISIT_TYPE_CONCEPT_ID' as clmn, visit_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_OCCURRENCE left join concept on (visit_type_concept_id = CONCEPT_ID)
union all select 'VISIT_OCCURRENCE' as tbl, 'VISIT_SOURCE_CONCEPT_ID' as clmn, visit_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_OCCURRENCE left join concept on (visit_source_concept_id = CONCEPT_ID)
union all select 'VISIT_DETAIL' as tbl, 'VISIT_DETAIL_CONCEPT_ID' as clmn, visit_detail_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_DETAIL left join concept on (visit_detail_concept_id = CONCEPT_ID)
union all select 'VISIT_DETAIL' as tbl, 'VISIT_DETAIL_TYPE_CONCEPT_ID' as clmn, visit_detail_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_DETAIL left join concept on (visit_detail_type_concept_id = CONCEPT_ID)
union all select 'VISIT_DETAIL' as tbl, 'VISIT_DETAIL_SOURCE_CONCEPT_ID' as clmn, visit_detail_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from VISIT_DETAIL left join concept on (visit_detail_source_concept_id = CONCEPT_ID)
union all select 'CONDITION_OCCURRENCE' as tbl, 'CONDITION_CONCEPT_ID' as clmn, condition_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from CONDITION_OCCURRENCE left join concept on (condition_concept_id = CONCEPT_ID)
union all select 'CONDITION_OCCURRENCE' as tbl, 'CONDITION_TYPE_CONCEPT_ID' as clmn, condition_type_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from CONDITION_OCCURRENCE left join concept on (condition_type_concept_id = CONCEPT_ID)
union all select 'CONDITION_OCCURRENCE' as tbl, 'CONDITION_STATUS_CONCEPT_ID' as clmn, condition_status_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from CONDITION_OCCURRENCE left join concept on (condition_status_concept_id = CONCEPT_ID)
union all select 'CONDITION_OCCURRENCE' as tbl, 'CONDITION_SOURCE_CONCEPT_ID' as clmn, condition_source_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from CONDITION_OCCURRENCE left join concept on (condition_source_concept_id = CONCEPT_ID)
union all select 'DRUG_EXPOSURE' as tbl, 'DRUG_CONCEPT_ID' as clmn, drug_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DRUG_EXPOSURE left join concept on (drug_concept_id = CONCEPT_ID)
union all select 'DRUG_EXPOSURE' as tbl, 'DRUG_TYPE_CONCEPT_ID' as clmn, drug_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DRUG_EXPOSURE left join concept on (drug_type_concept_id = CONCEPT_ID)
union all select 'DRUG_EXPOSURE' as tbl, 'ROUTE_CONCEPT_ID' as clmn, route_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DRUG_EXPOSURE left join concept on (route_concept_id = CONCEPT_ID)
union all select 'DRUG_EXPOSURE' as tbl, 'DRUG_SOURCE_CONCEPT_ID' as clmn, drug_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DRUG_EXPOSURE left join concept on (drug_source_concept_id = CONCEPT_ID)
union all select 'PROCEDURE_OCCURRENCE' as tbl, 'PROCEDURE_CONCEPT_ID' as clmn, procedure_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from PROCEDURE_OCCURRENCE left join concept on (procedure_concept_id = CONCEPT_ID)
union all select 'PROCEDURE_OCCURRENCE' as tbl, 'PROCEDURE_TYPE_CONCEPT_ID' as clmn, procedure_type_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from PROCEDURE_OCCURRENCE left join concept on (procedure_type_concept_id = CONCEPT_ID)
union all select 'PROCEDURE_OCCURRENCE' as tbl, 'MODIFIER_CONCEPT_ID' as clmn, modifier_concept_id as tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id from PROCEDURE_OCCURRENCE left join concept on (modifier_concept_id = CONCEPT_ID)
union all select 'DEVICE_EXPOSURE' as tbl, 'DEVICE_CONCEPT_ID' as clmn, device_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEVICE_EXPOSURE left join concept on (device_concept_id = CONCEPT_ID)
union all select 'DEVICE_EXPOSURE' as tbl, 'DEVICE_TYPE_CONCEPT_ID' as clmn, device_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEVICE_EXPOSURE left join concept on (device_type_concept_id = CONCEPT_ID)
union all select 'DEVICE_EXPOSURE' as tbl, 'DEVICE_SOURCE_CONCEPT_ID' as clmn, device_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEVICE_EXPOSURE left join concept on (device_source_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'MEASUREMENT_CONCEPT_ID' as clmn, measurement_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (measurement_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'MEASUREMENT_TYPE_CONCEPT_ID' as clmn, measurement_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (measurement_type_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'OPERATOR_CONCEPT_ID' as clmn, operator_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (operator_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'VALUE_AS_CONCEPT_ID' as clmn, value_as_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (value_as_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'UNIT_CONCEPT_ID' as clmn, unit_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (unit_concept_id = CONCEPT_ID)
union all select 'MEASUREMENT' as tbl, 'MEASUREMENT_SOURCE_CONCEPT_ID' as clmn, measurement_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from MEASUREMENT left join concept on (measurement_source_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'OBSERVATION_CONCEPT_ID' as clmn, observation_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (observation_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'OBSERVATION_TYPE_CONCEPT_ID' as clmn, observation_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (observation_type_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'VALUE_AS_CONCEPT_ID' as clmn, value_as_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (value_as_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'QUALIFIER_CONCEPT_ID' as clmn, qualifier_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (qualifier_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'UNIT_CONCEPT_ID' as clmn, unit_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (unit_concept_id = CONCEPT_ID)
union all select 'OBSERVATION' as tbl, 'OBSERVATION_SOURCE_CONCEPT_ID' as clmn, observation_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from OBSERVATION left join concept on (observation_source_concept_id = CONCEPT_ID)
union all select 'DEATH' as tbl, 'DEATH_TYPE_CONCEPT_ID' as clmn, death_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEATH left join concept on (death_type_concept_id = CONCEPT_ID)
union all select 'DEATH' as tbl, 'CAUSE_CONCEPT_ID' as clmn, cause_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEATH left join concept on (cause_concept_id = CONCEPT_ID)
union all select 'DEATH' as tbl, 'CAUSE_SOURCE_CONCEPT_ID' as clmn, cause_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DEATH left join concept on (cause_source_concept_id = CONCEPT_ID)
union all select 'NOTE' as tbl, 'NOTE_TYPE_CONCEPT_ID' as clmn, note_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE left join concept on (note_type_concept_id = CONCEPT_ID)
union all select 'NOTE' as tbl, 'NOTE_CLASS_CONCEPT_ID' as clmn, note_class_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE left join concept on (note_class_concept_id = CONCEPT_ID)
union all select 'NOTE' as tbl, 'ENCODING_CONCEPT_ID' as clmn, encoding_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE left join concept on (encoding_concept_id = CONCEPT_ID)
union all select 'NOTE' as tbl, 'LANGUAGE_CONCEPT_ID' as clmn, language_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE left join concept on (language_concept_id = CONCEPT_ID)
union all select 'NOTE_NLP' as tbl, 'SECTION_CONCEPT_ID' as clmn, section_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE_NLP left join concept on (section_concept_id = CONCEPT_ID)
union all select 'NOTE_NLP' as tbl, 'NOTE_NLP_CONCEPT_ID' as clmn, note_nlp_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE_NLP left join concept on (note_nlp_concept_id = CONCEPT_ID)
union all select 'NOTE_NLP' as tbl, 'NOTE_NLP_SOURCE_CONCEPT_ID' as clmn, note_nlp_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from NOTE_NLP left join concept on (note_nlp_source_concept_id = CONCEPT_ID)
union all select 'SPECIMEN' as tbl, 'SPECIMEN_CONCEPT_ID' as clmn, specimen_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from SPECIMEN left join concept on (specimen_concept_id = CONCEPT_ID)
union all select 'SPECIMEN' as tbl, 'SPECIMEN_TYPE_CONCEPT_ID' as clmn, specimen_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from SPECIMEN left join concept on (specimen_type_concept_id = CONCEPT_ID)
union all select 'SPECIMEN' as tbl, 'UNIT_CONCEPT_ID' as clmn, unit_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from SPECIMEN left join concept on (unit_concept_id = CONCEPT_ID)
union all select 'SPECIMEN' as tbl, 'ANATOMIC_SITE_CONCEPT_ID' as clmn, anatomic_site_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from SPECIMEN left join concept on (anatomic_site_concept_id = CONCEPT_ID)
union all select 'SPECIMEN' as tbl, 'DISEASE_STATUS_CONCEPT_ID' as clmn, disease_status_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from SPECIMEN left join concept on (disease_status_concept_id = CONCEPT_ID)
union all select 'FACT_RELATIONSHIP' as tbl, 'DOMAIN_CONCEPT_ID_1' as clmn, domain_concept_id_1 as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from FACT_RELATIONSHIP left join concept on (domain_concept_id_1 = CONCEPT_ID)
union all select 'FACT_RELATIONSHIP' as tbl, 'DOMAIN_CONCEPT_ID_2' as clmn, domain_concept_id_2 as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from FACT_RELATIONSHIP left join concept on (domain_concept_id_2 = CONCEPT_ID)
union all select 'FACT_RELATIONSHIP' as tbl, 'RELATIONSHIP_CONCEPT_ID' as clmn, relationship_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from FACT_RELATIONSHIP left join concept on (relationship_concept_id = CONCEPT_ID)
union all select 'CARE_SITE' as tbl, 'PLACE_OF_SERVICE_CONCEPT_ID' as clmn, place_of_service_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from CARE_SITE left join concept on (place_of_service_concept_id = CONCEPT_ID)
union all select 'PROVIDER' as tbl, 'SPECIALTY_CONCEPT_ID' as clmn, specialty_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PROVIDER left join concept on (specialty_concept_id = CONCEPT_ID)
union all select 'PROVIDER' as tbl, 'GENDER_CONCEPT_ID' as clmn, gender_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PROVIDER left join concept on (gender_concept_id = CONCEPT_ID)
union all select 'PROVIDER' as tbl, 'SPECIALTY_SOURCE_CONCEPT_ID' as clmn, specialty_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PROVIDER left join concept on (specialty_source_concept_id = CONCEPT_ID)
union all select 'PROVIDER' as tbl, 'GENDER_SOURCE_CONCEPT_ID' as clmn, gender_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PROVIDER left join concept on (gender_source_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'PAYER_CONCEPT_ID' as clmn, payer_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (payer_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'PAYER_SOURCE_CONCEPT_ID' as clmn, payer_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (payer_source_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'PLAN_CONCEPT_ID' as clmn, plan_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (plan_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'PLAN_SOURCE_CONCEPT_ID' as clmn, plan_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (plan_source_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'SPONSOR_CONCEPT_ID' as clmn, sponsor_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (sponsor_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'SPONSOR_SOURCE_CONCEPT_ID' as clmn, sponsor_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (sponsor_source_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'STOP_REASON_CONCEPT_ID' as clmn, stop_reason_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (stop_reason_concept_id = CONCEPT_ID)
union all select 'PAYER_PLAN_PERIOD' as tbl, 'STOP_REASON_SOURCE_CONCEPT_ID' as clmn, stop_reason_source_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from PAYER_PLAN_PERIOD left join concept on (stop_reason_source_concept_id = CONCEPT_ID)
union all select 'COST' as tbl, 'COST_TYPE_CONCEPT_ID' as clmn, cost_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COST left join concept on (cost_type_concept_id = CONCEPT_ID)
union all select 'COST' as tbl, 'CURRENCY_CONCEPT_ID' as clmn, currency_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COST left join concept on (currency_concept_id = CONCEPT_ID)
union all select 'COST' as tbl, 'REVENUE_CODE_CONCEPT_ID' as clmn, revenue_code_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COST left join concept on (revenue_code_concept_id = CONCEPT_ID)
union all select 'COST' as tbl, 'DRG_CONCEPT_ID' as clmn, drg_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COST left join concept on (drg_concept_id = CONCEPT_ID)
union all select 'DRUG_ERA' as tbl, 'DRUG_CONCEPT_ID' as clmn, drug_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DRUG_ERA left join concept on (drug_concept_id = CONCEPT_ID)
union all select 'DOSE_ERA' as tbl, 'DRUG_CONCEPT_ID' as clmn, drug_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DOSE_ERA left join concept on (drug_concept_id = CONCEPT_ID)
union all select 'DOSE_ERA' as tbl, 'UNIT_CONCEPT_ID' as clmn, unit_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from DOSE_ERA left join concept on (unit_concept_id = CONCEPT_ID)
union all select 'CONDITION_ERA' as tbl, 'CONDITION_CONCEPT_ID' as clmn, condition_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from CONDITION_ERA left join concept on (condition_concept_id = CONCEPT_ID)
union all select 'COHORT_DEFINITION' as tbl, 'DEFINITION_TYPE_CONCEPT_ID' as clmn, definition_type_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COHORT_DEFINITION left join concept on (definition_type_concept_id = CONCEPT_ID)
union all select 'COHORT_DEFINITION' as tbl, 'SUBJECT_CONCEPT_ID' as clmn, subject_concept_id as tbl_concept_id ,CONCEPT_ID,concept_name,vocabulary_id from COHORT_DEFINITION left join concept on (subject_concept_id = CONCEPT_ID)
) as a group by tbl,clmn,tbl_concept_id,CONCEPT_ID,concept_name,vocabulary_id
order by vocabulary_id,tbl,clmn
None
| Field | Description | | --- | --- | | table_name | Table name | | column_name | Column name | | tbl_concept_id | Concept ID in the source table| | concept_id | Concept ID in the concept table | | concept_name | Concept name | | vocabulary_id | Vocabulary ID | | count | Count of occurrences |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.