def create_ocp_provider(self, cluster_id, cluster_alias): """Create OCP test provider.""" authentication_data = { 'uuid': uuid4(), 'provider_resource_name': cluster_id, } authentication_id = ProviderAuthentication(**authentication_data) authentication_id.save() billing_source_data = { 'uuid': uuid4(), 'bucket': '', } billing_source_id = ProviderBillingSource(**billing_source_data) billing_source_id.save() provider_uuid = uuid4() provider_data = { 'uuid': provider_uuid, 'name': cluster_alias, 'authentication': authentication_id, 'billing_source': billing_source_id, 'customer': None, 'created_by': None, 'type': 'OCP', 'setup_complete': False } provider = Provider(**provider_data) provider.save() self.cluster_alias = cluster_alias self.provider_uuid = provider_uuid return provider
def create_ocp_provider(self, cluster_id, cluster_alias, infrastructure_type="Unknown"): """Create OCP test provider.""" auth = baker.make(ProviderAuthentication, provider_resource_name=cluster_id) bill = baker.make(ProviderBillingSource, bucket="") provider_uuid = uuid4() provider_data = { "uuid": provider_uuid, "name": cluster_alias, "authentication": auth, "billing_source": bill, "customer": None, "created_by": None, "type": Provider.PROVIDER_OCP, "setup_complete": False, "infrastructure": None, } provider = Provider(**provider_data) infrastructure = ProviderInfrastructureMap( infrastructure_provider=provider, infrastructure_type=infrastructure_type ) infrastructure.save() provider.infrastructure = infrastructure provider.save() self.cluster_alias = cluster_alias self.provider_uuid = provider_uuid return provider
def create_ocp_provider(self, cluster_id, cluster_alias): """Create OCP test provider.""" auth = baker.make( ProviderAuthentication, provider_resource_name=cluster_id, ) bill = baker.make( ProviderBillingSource, bucket='', ) provider_uuid = uuid4() provider_data = { 'uuid': provider_uuid, 'name': cluster_alias, 'authentication': auth, 'billing_source': bill, 'customer': None, 'created_by': None, 'type': Provider.PROVIDER_OCP, 'setup_complete': False } provider = Provider(**provider_data) provider.save() self.cluster_alias = cluster_alias self.provider_uuid = provider_uuid return provider
def addProvider(): request_body = request.get_json() provider = Provider(id_Provider=request_body["id_Provider"], name_Provider=request_body["name_Provider"], active_Provider=request_body["active_Provider"]) properties = Provider_Details( id_Provider_Details=request_body["id_Provider"], id_Provider=request_body["id_Provider"], email_Provider_Details=request_body["email_Provider_Details"], phone_Provider_Details=request_body["phone_Provider_Details"], address_Provider_Details=request_body["address_Provider_Details"], payment_Type_Provider_Details=request_body[ "payment_Type_Provider_Details"]) db.session.add(provider) db.session.add(properties) db.session.commit() return jsonify("All good"), 200
def create(self, validated_data): provider = Provider(**validated_data) provider.save() return provider
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # make healthproviders impotable cwd_path = os.getcwd() health_providers_path = cwd_path + '/api/healthproviders/' sys.path.append(health_providers_path) from api.models import Provider # open csv and import providers csv_path = cwd_path + '/api/provider.csv' with open(csv_path) as csvfile: reader = csv.DictReader(csvfile) for row in reader: p = Provider() p.drg_defintion = row['DRG Definition'] p.provider_id = row['Provider Id'] p.name = row['Provider Name'] p.street_address = row['Provider Street Address'] p.city = row['Provider City'] p.state = row['Provider State'] p.zipcode = row['Provider Zip Code'] p.hospital_referral = row['Hospital Referral Region Description'] p.total_discharges = Decimal( sub(r'[^\d.]', '', row[' Total Discharges '])) p.avg_cov_charges = Decimal( sub(r'[^\d.]', '', row[' Average Covered Charges '])) p.avg_total_payments = Decimal( sub(r'[^\d.]', '', row[' Average Total Payments '])) p.avg_medicare_payments = Decimal(