public study_relationship(int _id, lookup _relationship_type, int _target_study_id) { id = _id; relationship_type = _relationship_type; target_study_id = _target_study_id; }
public object_relationship(int _id, lookup _relationship_type, int _target_object_id) { id = _id; relationship_type = _relationship_type; target_object_id = _target_object_id; }
public study_feature(int _id, lookup _feature_type, lookup _feature_value) { id = _id; feature_type = _feature_type; feature_value = _feature_value; }
public object_instance(int _id, lookup _repository_org, access_details _access_details, resource_details _resource_details) { id = _id; repository_org = _repository_org; access_details = _access_details; resource_details = _resource_details; }
public object_contributor(int _id, lookup _contribution_type, bool?_is_individual, individual _person, lookup _organisation) { id = _id; contribution_type = _contribution_type; is_individual = _is_individual; person = _person; organisation = _organisation; }
public object_title(int _id, lookup _title_type, string _title_text, string _lang_code, string _comments) { id = _id; title_type = _title_type; title_text = _title_text; lang_code = _lang_code; comments = _comments; }
public object_identifier(int _id, string _identifier_value, lookup _identifier_type, lookup _identifier_org, string _identifier_date) { id = _id; identifier_type = _identifier_type; identifier_org = _identifier_org; identifier_value = _identifier_value; identifier_date = _identifier_date; }
public study_identifier(int _id, string _identifier_value, lookup _identifier_type, lookup _identifier_org, string _identifier_date, string _identifier_link) { id = _id; identifier_value = _identifier_value; identifier_type = _identifier_type; identifier_org = _identifier_org; identifier_date = _identifier_date; identifier_link = _identifier_link; }
public object_description(int _id, lookup _description_type, string _description_label, string _description_text, string _lang_code, bool?_contains_html) { id = _id; description_type = _description_type; description_label = _description_label; description_text = _description_text; lang_code = _lang_code; contains_html = _contains_html; }
public object_date(int _id, lookup _date_type, bool?_is_date_range, string _date_as_string, sdate_as_ints _start_date, edate_as_ints _end_date, string _comments) { id = _id; date_type = _date_type; is_date_range = _is_date_range; date_as_string = _date_as_string; start_date = _start_date; end_date = _end_date; comments = _comments; }
public study_topic(int _id, lookup _topic_type, bool _mesh_coded, string _topic_code, string _topic_value, string _topic_qualcode, string _topic_qualvalue, string _original_value) { id = _id; topic_type = _topic_type; mesh_coded = _mesh_coded; topic_code = _topic_code; topic_value = _topic_value; topic_qualcode = _topic_qualcode; topic_qualvalue = _topic_qualvalue; original_value = _original_value; }
public JSONStudy(int _id, string _display_title, text_block _brief_description, text_block _data_sharing_statement, lookup _study_type, lookup _study_status, int?_study_enrolment, lookup _study_gender_elig, age_param _min_age, age_param _max_age, string _provenance_string) { file_type = "study"; id = _id; display_title = _display_title; brief_description = _brief_description; data_sharing_statement = _data_sharing_statement; study_type = _study_type; study_status = _study_status; study_enrolment = _study_enrolment; study_gender_elig = _study_gender_elig; min_age = _min_age; max_age = _max_age; provenance_string = _provenance_string; }
public JSONDataObject(int _id, string _doi, string _display_title, string _version, lookup _object_class, lookup _object_type, int?_publication_year, lookup _managing_organisation, string _lang_code, lookup _access_type, object_access _access_details, int?_eosc_category, string _provenance_string) { file_type = "data_object"; id = _id; doi = _doi; display_title = _display_title; version = _version; object_class = _object_class; object_type = _object_type; publication_year = _publication_year; managing_organisation = _managing_organisation; lang_code = _lang_code; access_type = _access_type; access_details = _access_details; eosc_category = _eosc_category; provenance_string = _provenance_string; }
public JSONStudy CreateStudyObject(int id) { // Re-initialise these compound properties. brief_description = null; data_sharing_statement = null; study_type = null; study_status = null; study_gender_elig = null; min_age = null; max_age = null; study_identifiers = null; study_titles = null; study_topics = null; study_features = null; study_relationships = null; linked_data_objects = null; // Get the singleton study properties from DB var s = repo.FetchDbStudy(id); // Instantiate the top level lookup types if (s.brief_description != null) { brief_description = new text_block(s.brief_description, s.bd_contains_html); } if (s.data_sharing_statement != null) { data_sharing_statement = new text_block(s.data_sharing_statement, s.dss_contains_html); } if (s.study_type_id != null) { study_type = new lookup(s.study_type_id, s.study_type); } if (s.study_status_id != null) { study_status = new lookup(s.study_status_id, s.study_status); } if (s.study_gender_elig_id != null) { study_gender_elig = new lookup(s.study_gender_elig_id, s.study_gender_elig); } if (s.min_age != null) { min_age = new age_param(s.min_age, s.min_age_units_id, s.min_age_units); } if (s.max_age != null) { max_age = new age_param(s.max_age, s.max_age_units_id, s.max_age_units); } // instantiate a (json) study object and // fill it with study level details JSONStudy jst = new JSONStudy(s.id, s.display_title, brief_description, data_sharing_statement, study_type, study_status, s.study_enrolment, study_gender_elig, min_age, max_age, s.provenance_string); // add the study identifier details var db_study_identifiers = new List <DBStudyIdentifier>(repo.FetchDbStudyIdentifiers(id)); if (db_study_identifiers.Count > 0) { study_identifiers = new List <study_identifier>(); foreach (DBStudyIdentifier t in db_study_identifiers) { study_identifiers.Add(new study_identifier(t.id, t.identifier_value, new lookup(t.identifier_type_id, t.identifier_type), new lookup(t.identifier_org_id, t.identifier_org), t.identifier_date, t.identifier_link)); } } // add the study title details var db_study_titles = new List <DBStudyTitle>(repo.FetchDbStudyTitles(id)); if (db_study_titles.Count > 0) { study_titles = new List <study_title>(); foreach (DBStudyTitle t in db_study_titles) { study_titles.Add(new study_title(t.id, new lookup(t.title_type_id, t.title_type), t.title_text, t.lang_code, t.comments)); } } // add the study feature details var db_study_features = new List <DBStudyFeature>(repo.FetchDbStudyFeatures(id)); if (db_study_features.Count > 0) { study_features = new List <study_feature>(); foreach (DBStudyFeature t in db_study_features) { study_features.Add(new study_feature(t.id, new lookup(t.feature_type_id, t.feature_type), new lookup(t.feature_value_id, t.feature_value))); } } // add the study topic details var db_study_topics = new List <DBStudyTopic>(repo.FetchDbStudyTopics(id)); if (db_study_topics.Count > 0) { study_topics = new List <study_topic>(); foreach (DBStudyTopic t in db_study_topics) { study_topics.Add(new study_topic(t.id, new lookup(t.topic_type_id, t.topic_type), t.mesh_coded, t.topic_code, t.topic_value, t.topic_qualcode, t.topic_qualvalue, t.original_value)); } } // add the study relationships, if any var db_study_relationships = new List <DBStudyRelationship>(repo.FetchDbStudyRelationships(id)); if (db_study_relationships.Count > 0) { study_relationships = new List <study_relationship>(); foreach (DBStudyRelationship t in db_study_relationships) { study_relationships.Add(new study_relationship(t.id, new lookup(t.relationship_type_id, t.relationship_type), t.target_study_id)); } } // add the related objects data var db_study_object_links = new List <DBStudyObjectLink>(repo.FetchDbStudyObjectLinks(id)); if (db_study_object_links.Count > 0) { linked_data_objects = new List <int>(); foreach (DBStudyObjectLink t in db_study_object_links) { linked_data_objects.Add(t.object_id); } } // return the resulting 'json ready' study jst.study_identifiers = study_identifiers; jst.study_titles = study_titles; jst.study_features = study_features; jst.study_topics = study_topics; jst.study_relationships = study_relationships; jst.linked_data_objects = linked_data_objects; return(jst); }
public JSONDataObject CreateObject(int id) { // Re-initialise these compound properties. object_class = null; object_type = null; access_type = null; managing_organisation = null; access_details = null; ds_record_keys = null; ds_deident_level = null; ds_consent = null; object_titles = null; object_contributors = null; object_dates = null; object_instances = null; object_topics = null; object_identifiers = null; object_descriptions = null; object_rights = null; object_relationships = null; linked_studies = null; // Get the singleton data object properties from DB ob = repo.FetchDbDataObject(id); // First check there is at least one linked study // (several hundred of the journal articles are not linked). linked_studies = new List <int>(repo.FetchLinkedStudies(id)); if (linked_studies.Count == 0) { // May occur in a few hundred cases, therefore // if it does need to investigate further !!!!!!! // Possible (minor) error in data object linkage with journal articles. logging_repo.LogError("object " + ob.id + " does not appear to be linked to studies"); return(null); } // Instantiate the top level lookup types object_class = new lookup(ob.object_class_id, ob.object_class); object_type = new lookup(ob.object_type_id, ob.object_type); if (ob.managing_org != null) { managing_organisation = new lookup(ob.managing_org_id, ob.managing_org); } if (ob.access_type_id != null) { access_type = new lookup(ob.access_type_id, ob.access_type); } if (ob.access_details != null || ob.access_details_url != null) { access_details = new object_access(ob.access_details, ob.access_details_url, ob.url_last_checked); } // Instantiate data object with those details JSONDataObject dobj = new JSONDataObject(ob.id, ob.doi, ob.display_title, ob.version, object_class, object_type, ob.publication_year, managing_organisation, ob.lang_code, access_type, access_details, ob.eosc_category, ob.provenance_string); // Get dataset properties, if there are any... var db_ds = repo.FetchDbDatasetProperties(id); if (db_ds != null) { ds_record_keys = new record_keys(db_ds.record_keys_type_id, db_ds.record_keys_type, db_ds.record_keys_details); ds_deident_level = new deidentification(db_ds.deident_type_id, db_ds.deident_type, db_ds.deident_direct, db_ds.deident_hipaa, db_ds.deident_dates, db_ds.deident_nonarr, db_ds.deident_kanon, db_ds.deident_details); ds_consent = new consent(db_ds.consent_type_id, db_ds.consent_type, db_ds.consent_noncommercial, db_ds.consent_geog_restrict, db_ds.consent_research_type, db_ds.consent_genetic_only, db_ds.consent_no_methods, db_ds.consent_details); dobj.dataset_record_keys = ds_record_keys; dobj.dataset_deident_level = ds_deident_level; dobj.dataset_consent = ds_consent; } // Get object instances. var db_object_instances = new List <DBObjectInstance>(repo.FetchObjectInstances(id)); if (db_object_instances.Count > 0) { object_instances = new List <object_instance>(); foreach (DBObjectInstance i in db_object_instances) { lookup repo_org = null; access_details access = null; resource_details resource = null; if (i.repository_org != null) { repo_org = new lookup(i.repository_org_id, i.repository_org); } if (i.url != null || i.url_accessible != null) { access = new access_details(i.url, i.url_accessible, i.url_last_checked); } if (i.resource_type_id != null || i.comments != null) { resource = new resource_details(i.resource_type_id, i.resource_type, i.resource_size, i.resource_size_units, i.comments); } object_instances.Add(new object_instance(i.id, repo_org, access, resource)); } } // Get object titles. var db_object_titles = new List <DBObjectTitle>(repo.FetchObjectTitles(id)); if (db_object_titles.Count > 0) { object_titles = new List <object_title>(); foreach (DBObjectTitle t in db_object_titles) { object_titles.Add(new object_title(t.id, new lookup(t.title_type_id, t.title_type), t.title_text, t.lang_code, t.comments)); } } // Get object dates. var db_object_dates = new List <DBObjectDate>(repo.FetchObjectDates(id)); if (db_object_dates.Count > 0) { object_dates = new List <object_date>(); sdate_as_ints start_date = null; edate_as_ints end_date = null; foreach (DBObjectDate d in db_object_dates) { if (d.start_year != null || d.start_month != null || d.start_day != null) { start_date = new sdate_as_ints(d.start_year, d.start_month, d.start_day); } if (d.end_year != null || d.end_month != null || d.end_day != null) { end_date = new edate_as_ints(d.end_year, d.end_month, d.end_day); } object_dates.Add(new object_date(d.id, new lookup(d.date_type_id, d.date_type), d.is_date_range, d.date_as_string, start_date, end_date, d.comments)); } } // Get object contributors - var db_object_contributors = new List <DBObjectContributor>(repo.FetchObjectContributors(id, ob.add_study_contribs)); if (db_object_contributors.Count > 0) { individual person; lookup org; object_contributors = new List <object_contributor>(); foreach (DBObjectContributor c in db_object_contributors) { person = null; org = null; if (c.is_individual) { person = new individual(c.person_family_name, c.person_given_name, c.person_full_name, c.person_identifier, c.affiliation); } else { org = new lookup(c.organisation_id, c.organisation_name); } object_contributors.Add(new object_contributor(c.id, new lookup(c.contrib_type_id, c.contrib_type), c.is_individual, person, org)); } } // Get object topics - // source will depend on boolean flag, itself dependent on the type of object. var db_object_topics = new List <DBObjectTopic>(repo.FetchObjectTopics(id, ob.add_study_topics)); if (db_object_topics.Count > 0) { object_topics = new List <object_topic>(); foreach (DBObjectTopic t in db_object_topics) { object_topics.Add(new object_topic(t.id, new lookup(t.topic_type_id, t.topic_type), t.mesh_coded, t.topic_code, t.topic_value, t.topic_qualcode, t.topic_qualvalue, t.original_value)); } } // Get object identifiers. var db_object_identifiers = new List <DBObjectIdentifier>(repo.FetchObjectIdentifiers(id)); if (db_object_identifiers.Count > 0) { object_identifiers = new List <object_identifier>(); foreach (DBObjectIdentifier i in db_object_identifiers) { object_identifiers.Add(new object_identifier(i.id, i.identifier_value, new lookup(i.identifier_type_id, i.identifier_type), new lookup(i.identifier_org_id, i.identifier_org), i.identifier_date)); } } // Get object descriptions. var db_object_descriptions = new List <DBObjectDescription>(repo.FetchObjectDescriptions(id)); if (db_object_descriptions.Count > 0) { object_descriptions = new List <object_description>(); foreach (DBObjectDescription i in db_object_descriptions) { object_descriptions.Add(new object_description(i.id, new lookup(i.description_type_id, i.description_type), i.label, i.description_text, i.lang_code, i.contains_html)); } } // Get object rights. var db_object_rights = new List <DBObjectRight>(repo.FetchObjectRights(id)); if (db_object_rights.Count > 0) { object_rights = new List <object_right>(); foreach (DBObjectRight i in db_object_rights) { object_rights.Add(new object_right(i.id, i.rights_name, i.rights_uri, i.comments)); } } // Get object relationships. var db_object_relationships = new List <DBObjectRelationship>(repo.FetchObjectRelationships(id)); if (db_object_relationships.Count > 0) { object_relationships = new List <object_relationship>(); foreach (DBObjectRelationship i in db_object_relationships) { object_relationships.Add(new object_relationship(i.id, new lookup(i.relationship_type_id, i.relationship_type), i.target_object_id)); } } // Construct the final data object by setting the composite // and repreated properties to the classess and List<>s created above. dobj.dataset_consent = ds_consent; dobj.dataset_record_keys = ds_record_keys; dobj.dataset_deident_level = ds_deident_level; dobj.object_identifiers = object_identifiers; dobj.object_titles = object_titles; dobj.object_contributors = object_contributors; dobj.object_dates = object_dates; dobj.object_instances = object_instances; dobj.object_descriptions = object_descriptions; dobj.object_rights = object_rights; dobj.object_topics = object_topics; dobj.object_relationships = object_relationships; dobj.linked_studies = linked_studies; return(dobj); }